package com.erpoa.service.impl;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.erpoa.dto.ColipuoRelult;
import com.erpoa.entity.ErpAccessoriesData;
import com.erpoa.mapper.ImaFileMapper;
import com.erpoa.service.ImaFileService;
import com.erpoa.utils.*;
import com.erpoa.webservice.*;
import org.apache.commons.lang3.math.NumberUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.FileSystemResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.thymeleaf.TemplateEngine;

import java.text.DecimalFormat;
import java.util.*;

/**
 * @Author:0xOO
 * @Date: 2018/9/26 0026
 * @Time: 15:23
 */
@Service
public class ImaFileServiceImpl implements ImaFileService {

    private static final Logger logger = LoggerFactory.getLogger(ImaFileServiceImpl.class);


    @Autowired
    private ImaFileMapper imaFileMapper;


    @Autowired
    MailUtil mailUtil;
    // 注入模板引擎
    @Autowired
    TemplateEngine templateEngine;

    /**
     *
     * @param sqId
     * @param ds
     * @return
     */
    @Override
    public Integer count(Integer sqId, String ds,String workshop, String purchase, String v_gmisc) {

        ERPWSImplService erpwsImplService = new ERPWSImplService();

        FindUserInfoByHRNo infoByHRNo = new FindUserInfoByHRNo();
        infoByHRNo.setHrNo("185469");
        UserInfo info = erpwsImplService.getERPWSImplPort().findUserInfoByHRNo("185469");
        return imaFileMapper.count(sqId,ds, workshop,  purchase, v_gmisc);
    }

    /**
     *
     * @param sqId
     * @param ds
     * @return
     */
    @Override
    public String syncFlow(Integer sqId, String ds, String workshop, String purchase,String v_gmisc) {
        HashMap<String,Object> sqdt = imaFileMapper.querySqDtById(sqId,ds);
        if(sqdt==null){
            return "-16";
        }

        String TC_SQDTMODUtemp = sqdt.get("TC_SQDTMODU")!=null? sqdt.get("TC_SQDTMODU").toString(): "0";
      /*  DecimalFormat g1=new DecimalFormat("000000");
        String TC_SQDTMODU = g1.format(Integer.valueOf(TC_SQDTMODUtemp));*/

        String TC_SQDTMODU ;
        if(NumberUtils.isDigits(TC_SQDTMODUtemp)){
            DecimalFormat g1=new DecimalFormat("000000");
            TC_SQDTMODU = g1.format(Integer.valueOf(TC_SQDTMODUtemp));}
        else {
            TC_SQDTMODU = TC_SQDTMODUtemp;
        }

        ERPWSImplService erpwsImplService = new ERPWSImplService();
        int sqdscount = imaFileMapper.count(sqId, ds , workshop,  purchase, v_gmisc);
        if (sqdscount==0){
            return  "-17";
        }

        UserInfo info  =  erpwsImplService.getERPWSImplPort().findUserInfoByHRNo(TC_SQDTMODU);
        if (!info.isSuccess()){
            return  "-14";
        }

        List<Map<String, Object>> sqdsList = imaFileMapper.querySqDsById(sqId,  ds, workshop,purchase,v_gmisc);

        if (CollectionUtils.isEmpty(sqdsList)){
            return "-20";
        }
        String TC_SQDS17 = sqdsList.get(0).get("TC_SQDS17")!=null? sqdsList.get(0).get("TC_SQDS17").toString().trim(): "无";

        if(!NumberUtils.isDigits(TC_SQDS17)) {
            return "-21";
        }

        WorkflowRequestInfo requestInfo = erpwsImplService.getERPWSImplPort().getWorkflowRequest(Integer.valueOf(TC_SQDS17), Integer.valueOf(info.getUserId()), 26183);//TODO 26183 20200107 23688
        if(null== requestInfo){
            return "-18";
        }

        logger.debug(JSON.toJSONString(requestInfo));

        if ("归档".equals(requestInfo.getCurrentNodeName().trim())){
            //增加是否少单的情况
            if ("MISC".equals(v_gmisc)) {
                int count1 = this.imaFileMapper.countcpmla(TC_SQDS17, ds);
                String count2 = this.imaFileMapper.selectByrequestid(TC_SQDS17);
                if (StringUtil.isNotEmpty(count2)) {
                    int hh = count2.split("--").length;
                    if (count1 != hh) {
                        return "-45";
                    }

                }
            }
            return "-19";
        }
        return requestInfo.getStatus();
    }


    /**
     *
     * @param
     * @param sqId
     * @param ds
     * @param purchase
     * @return
     */
    @Override
    @Transactional
    public String CreatFlowEquipment(Integer sqId, String ds, String workshop, String purchase,String v_gmisc) {

        HashMap<String,Object> dept =  imaFileMapper.selectDeptByCode(purchase);

        String OADEPTID = (dept!=null)&&(dept.get("TC_OADEPTID")!=null)? dept.get("TC_OADEPTID").toString(): "";
        if ("".equals(OADEPTID)){
            return "-11";
        }

        HashMap<String,Object> sqdt = imaFileMapper.querySqDtById(sqId,ds);
        if(sqdt==null){
            return "-12";
        }
        //workflowRequestInfo
        WorkflowRequestInfo workflowRequestInfo = new WorkflowRequestInfo();
        String TC_SQDT02 = sqdt.get("TC_SQDT02")!=null? sqdt.get("TC_SQDT02").toString(): "";

        String TC_SQDT04 = sqdt.get("TC_SQDT04")!=null? sqdt.get("TC_SQDT04").toString(): "无";
        String TC_SQDT05 = sqdt.get("TC_SQDT05")!=null? sqdt.get("TC_SQDT05").toString(): "无";
        String TC_SQDT06 = sqdt.get("TC_SQDT06")!=null? sqdt.get("TC_SQDT06").toString(): "无";
        String TC_SQDT03 = sqdt.get("TC_SQDT03")!=null? sqdt.get("TC_SQDT03").toString(): "0";

        TC_SQDT02 = TC_SQDT02 +"-"+ workshop + "-"+purchase;
        workflowRequestInfo.setRequestName(TC_SQDT02);//TODO
        //
        workflowRequestInfo.setCanEdit(false);
        workflowRequestInfo.setCanView(true);
        String TC_SQDT07 =sqdt.get("TC_SQDT07")!=null? sqdt.get("TC_SQDT07").toString(): "2999-12-31";

        workflowRequestInfo.setCreateTime(TC_SQDT07);
        String GEN02 = sqdt.get("GEN02")!=null? sqdt.get("GEN02").toString(): "无";
        workflowRequestInfo.setCreatorName(GEN02);
        //workflowBaseInfo
        WorkflowBaseInfo workflowBaseInfo = new WorkflowBaseInfo();
        workflowBaseInfo.setWorkflowId("26183");//23688  20200107 26183
        workflowBaseInfo.setWorkflowName("生产辅料申购单");

        //
        ERPWSImplService erpwsImplService = new ERPWSImplService();
        if (sqdt.get("TC_SQDTMODU") == null ){
            return  "-13";
        }
        String TC_SQDTMODUtemp = sqdt.get("TC_SQDTMODU")!=null? sqdt.get("TC_SQDTMODU").toString(): "0";
        String TC_SQDTMODU;
        if(NumberUtils.isDigits(TC_SQDTMODUtemp)){
            DecimalFormat g1=new DecimalFormat("000000");
            TC_SQDTMODU = g1.format(Integer.valueOf(TC_SQDTMODUtemp));}
        else {
            TC_SQDTMODU = TC_SQDTMODUtemp;
        }
        UserInfo info = erpwsImplService.getERPWSImplPort().findUserInfoByHRNo(TC_SQDTMODU);
        if (!info.isSuccess()){
            return  "-14";
        }
        workflowRequestInfo.setCreatorId(info.getUserId());

        //workflowMainTableInfo
        WorkflowMainTableInfo workflowMainTableInfo = new WorkflowMainTableInfo();
        workflowMainTableInfo.setTableDBName("formtable_main_100");
        WorkflowRequestTableRecord workflowRequestTableRecord = new WorkflowRequestTableRecord();

        workflowRequestTableRecord.setRecordOrder(0);
        WorkflowRequestTableField workflowRequestTableFieldbiaoti = new WorkflowRequestTableField();
        workflowRequestTableFieldbiaoti.setEdit(true);
        workflowRequestTableFieldbiaoti.setFieldFormName("requestname");
        workflowRequestTableFieldbiaoti.setFieldHtmlType("1");
        workflowRequestTableFieldbiaoti.setFieldId("-1");
        workflowRequestTableFieldbiaoti.setFieldName("requestname");
        workflowRequestTableFieldbiaoti.setFieldOrder(-1);
        workflowRequestTableFieldbiaoti.setFieldShowName("标题");
        workflowRequestTableFieldbiaoti.setFieldShowValue(TC_SQDT02);//TODO
        workflowRequestTableFieldbiaoti.setFieldValue(TC_SQDT02);//TODO
        workflowRequestTableFieldbiaoti.setFieldHtmlType(TC_SQDT02);//TODO
        workflowRequestTableFieldbiaoti.setMand(true);
        workflowRequestTableFieldbiaoti.setView(true);
        workflowRequestTableRecord.getWorkflowRequestTableFields().add(workflowRequestTableFieldbiaoti);
        //REQUESTLEVEL
        //MESSAGETYPE
        //MISC物料查看国内
        //MISC物料查看行政
        //上月
        //TODO 所属分厂
        WorkflowRequestTableField workflowRequestTableFieldshfc = new WorkflowRequestTableField();
        // imaFileMapper.queryshfc();
        workflowRequestTableFieldshfc.setEdit(true);
        workflowRequestTableFieldshfc.setFieldDBType("integer");
        workflowRequestTableFieldshfc.setFieldFormName("field8444");
        workflowRequestTableFieldshfc.setFieldHtmlType("3");
        workflowRequestTableFieldshfc.setFieldId("8444");
        workflowRequestTableFieldshfc.setFieldName("shfc");
        workflowRequestTableFieldshfc.setFieldOrder(3);
        workflowRequestTableFieldshfc.setFieldShowName("所属分厂");

        HashMap<String,Object> oaud =  imaFileMapper.selectOaDeptByCode(TC_SQDTMODU);
        // HashMap<String,Object> dept2 =  imaFileMapper.selectDeptByCode(TC_SQDT05);
        String SHFC =(oaud!=null)&&(oaud.get("SHFC")!=null)? oaud.get("SHFC").toString(): "无";
        String SQBM =(oaud!=null)&&(oaud.get("SQBM")!=null)? oaud.get("SQBM").toString(): "无";
        String ZJSJGH = (oaud!=null)&&(oaud.get("ZJSJGH")!=null)? oaud.get("ZJSJGH").toString(): "无";
        String FENJIHAO = (oaud != null) && (oaud.get("TELEPHONE") != null) ? oaud.get("TELEPHONE").toString() : "当前部门没有维护";
        logger.debug(TC_SQDTMODU);
        logger.debug(ZJSJGH);
        logger.debug(SHFC);
        logger.debug(SQBM);
        if ("无".equals(SHFC)){
            return "-11";
        }
        if ("无".equals(SQBM)){
            return "-11";
        }
        if ("无".equals(ZJSJGH)){
            return "-11";
        }

        WorkflowRequestTableField workflowRequestTableZjsjgh = new WorkflowRequestTableField();
        workflowRequestTableZjsjgh.setEdit(true);
        workflowRequestTableZjsjgh.setFieldDBType("varchar2(60)");
        workflowRequestTableZjsjgh.setFieldFormName("field13474");
        workflowRequestTableZjsjgh.setFieldHtmlType("1");
        workflowRequestTableZjsjgh.setFieldId("13474");
        workflowRequestTableZjsjgh.setFieldName("ZJSJGH");
        // workflowRequestTableZjsjgh.setFieldOrder(60);
        workflowRequestTableZjsjgh.setFieldShowName("上级工号");
        workflowRequestTableZjsjgh.setFieldShowValue(ZJSJGH);
        workflowRequestTableZjsjgh.setFieldType("1");
        workflowRequestTableZjsjgh.setFieldValue(ZJSJGH);
        workflowRequestTableZjsjgh.setFiledHtmlShow(ZJSJGH);
        workflowRequestTableZjsjgh.setMand(false);
        workflowRequestTableZjsjgh.setView(true);
        workflowRequestTableRecord.getWorkflowRequestTableFields().add(workflowRequestTableZjsjgh);
        UserInfo info1  =  erpwsImplService.getERPWSImplPort().findUserInfoByHRNo(ZJSJGH);
        if (!info.isSuccess()){
            return  "-14";
        }
        //TODO
        WorkflowRequestTableField workflowRequestTableZjsj = new WorkflowRequestTableField();
        workflowRequestTableZjsj.setEdit(true);
        workflowRequestTableZjsj.setFieldDBType("varchar2(60)");
        workflowRequestTableZjsj.setFieldFormName("field13473");
        workflowRequestTableZjsj.setFieldHtmlType("1");
        workflowRequestTableZjsj.setFieldId("13473");
        workflowRequestTableZjsj.setFieldName("ZJSJ");
        // workflowRequestTableZjsjgh.setFieldOrder(60);
        workflowRequestTableZjsj.setFieldShowName("上级工号");
        workflowRequestTableZjsj.setFieldShowValue(info1.getUserId());
        workflowRequestTableZjsj.setFieldType("1");
        workflowRequestTableZjsj.setFieldValue(info1.getUserId());
        workflowRequestTableZjsj.setFiledHtmlShow(info1.getUserId());
        workflowRequestTableZjsj.setMand(false);
        workflowRequestTableZjsj.setView(true);
        workflowRequestTableRecord.getWorkflowRequestTableFields().add(workflowRequestTableZjsj);
        workflowRequestTableFieldshfc.setFieldShowValue(SHFC);//TODO
        workflowRequestTableFieldshfc.setFieldType("4");
        workflowRequestTableFieldshfc.setFieldValue(SHFC);//TODO
        workflowRequestTableFieldshfc.setFieldHtmlType(SHFC);//TODO
        workflowRequestTableFieldshfc.setMand(false);
        workflowRequestTableFieldshfc.setView(true);
        workflowRequestTableRecord.getWorkflowRequestTableFields().add(workflowRequestTableFieldshfc);
        //权限值
        //单别中文
        WorkflowRequestTableField workflowRequestTableFieldbzw = new WorkflowRequestTableField();
        workflowRequestTableFieldbzw.setEdit(true);
        workflowRequestTableFieldbzw.setFieldDBType("varchar2(200)");
        workflowRequestTableFieldbzw.setFieldFormName("field8557");
        workflowRequestTableFieldbzw.setFieldHtmlType("1");
        workflowRequestTableFieldbzw.setFieldId("8557");
        workflowRequestTableFieldbzw.setFieldName("dbzw");
        workflowRequestTableFieldbzw.setFieldOrder(5);
        workflowRequestTableFieldbzw.setFieldShowName("所属分厂");
        workflowRequestTableFieldbzw.setFieldType("1");
        if("MISC".equals(v_gmisc)){
            if ("DS2".equals(ds)){
                TC_SQDT05 = "AFQ" ;
            }else {
                TC_SQDT05 = "OFQ" ;
            }

        }
        String SMYDESC = imaFileMapper.qrySmyDesc(TC_SQDT05.trim(),ds);
        String newStr = "";
        if(SMYDESC != null && SMYDESC.length() != 0)
        {
            if ("费用请购单(MISC)".equals(SMYDESC)) {
                newStr = SMYDESC.replaceAll("费用请购单", "ERP分流 费用请购单 ");
            } else {
                newStr = SMYDESC.replaceAll("人工", "ERP分流 ");
            }
        }
        logger.debug("SMYDESC"+newStr);
        workflowRequestTableFieldbzw.setFieldShowValue(newStr);//TODO
        workflowRequestTableFieldbzw.setFieldValue(newStr);//TODO
        workflowRequestTableFieldbzw.setFieldHtmlType(newStr);//TODO
        workflowRequestTableFieldbzw.setMand(false);
        workflowRequestTableFieldbzw.setView(true);
        workflowRequestTableRecord.getWorkflowRequestTableFields().add(workflowRequestTableFieldbzw);

        //本次采购金额
      /*   WorkflowRequestTableField workflowRequestTabledbje = new WorkflowRequestTableField();
        workflowRequestTabledbje.setEdit(true);
        workflowRequestTabledbje.setFieldDBType("number(15,2)");
        workflowRequestTabledbje.setFieldFormName("field8147");
        workflowRequestTabledbje.setFieldHtmlType("1");
        workflowRequestTabledbje.setFieldId("8147");
        workflowRequestTabledbje.setFieldName("je");
        workflowRequestTabledbje.setFieldOrder(33);
        workflowRequestTabledbje.setFieldShowName("本次采购金额");
        workflowRequestTabledbje.setFieldShowValue(TC_SQDT05);
        workflowRequestTabledbje.setFieldType("3");
        workflowRequestTabledbje.setFieldValue(TC_SQDT05);//TODO
        workflowRequestTabledbje.setFiledHtmlShow(TC_SQDT05);
        workflowRequestTabledbje.setMand(false);
        workflowRequestTabledbje.setView(true);
        workflowRequestTableRecord.getWorkflowRequestTableFields().add(workflowRequestTabledbje);*/
        //je
        //TODO db
        WorkflowRequestTableField workflowRequestTabledb = new WorkflowRequestTableField();
        workflowRequestTabledb.setEdit(true);
        workflowRequestTabledb.setFieldDBType("browser.djlb");
        workflowRequestTabledb.setFieldFormName("field8148");
        workflowRequestTabledb.setFieldHtmlType("3");
        workflowRequestTabledb.setFieldId("8148");
        workflowRequestTabledb.setFieldName("db");
        workflowRequestTabledb.setFieldOrder(34);
        workflowRequestTabledb.setFieldShowName(TC_SQDT05);
        workflowRequestTabledb.setFieldShowValue(TC_SQDT05);
        workflowRequestTabledb.setFieldType("161");
        workflowRequestTabledb.setFieldValue(TC_SQDT05);//TODO
        workflowRequestTabledb.setFiledHtmlShow(TC_SQDT05);
        workflowRequestTabledb.setMand(false);
        workflowRequestTabledb.setView(true);
        workflowRequestTableRecord.getWorkflowRequestTableFields().add(workflowRequestTabledb);
//ssy
        WorkflowRequestTableField workflowRequestTableFieldssy = new WorkflowRequestTableField();
        workflowRequestTableFieldssy.setEdit(true);
        workflowRequestTableFieldssy.setFieldDBType("varchar2(200)");
        workflowRequestTableFieldssy.setFieldFormName("field8582");
        workflowRequestTableFieldssy.setFieldHtmlType("1");
        workflowRequestTableFieldssy.setFieldId("8582");
        workflowRequestTableFieldssy.setFieldName("ssy");
        workflowRequestTableFieldssy.setFieldOrder(6);
        workflowRequestTableFieldssy.setFieldShowName("上上月");
        workflowRequestTableFieldssy.setFieldShowValue("201909");//TODO
        workflowRequestTableFieldssy.setFieldType("1");
        workflowRequestTableFieldssy.setFieldValue("201909");//TODO
        workflowRequestTableFieldssy.setFiledHtmlShow("201909");//TODO
        workflowRequestTableFieldssy.setMand(false);
        workflowRequestTableFieldssy.setView(true);
        workflowRequestTableRecord.getWorkflowRequestTableFields().add(workflowRequestTableFieldssy);
        //TODOyjdhrq
        WorkflowRequestTableField workflowRequestTableFielyjdhrq = new WorkflowRequestTableField();
        workflowRequestTableFielyjdhrq.setEdit(true);
        workflowRequestTableFielyjdhrq.setFieldDBType("char(10)");
        workflowRequestTableFielyjdhrq.setFieldFormName("field8598");
        workflowRequestTableFielyjdhrq.setFieldHtmlType("3");
        workflowRequestTableFielyjdhrq.setFieldId("8598");
        workflowRequestTableFielyjdhrq.setFieldName("yjdhrq");
        workflowRequestTableFielyjdhrq.setFieldOrder(7);
        workflowRequestTableFielyjdhrq.setFieldShowName("预计到货日期");
        workflowRequestTableFielyjdhrq.setFieldShowValue(TC_SQDT07);//TODO
        workflowRequestTableFielyjdhrq.setFieldType("2");
        workflowRequestTableFielyjdhrq.setFieldValue(TC_SQDT07);//TODO
        workflowRequestTableFielyjdhrq.setFiledHtmlShow(TC_SQDT07);//TODO
        workflowRequestTableFielyjdhrq.setMand(true);
        workflowRequestTableFielyjdhrq.setView(true);
        workflowRequestTableRecord.getWorkflowRequestTableFields().add(workflowRequestTableFielyjdhrq);
//cgmc1
        //bs1
        WorkflowRequestTableField workflowRequestTableFielybs1 = new WorkflowRequestTableField();
        workflowRequestTableFielybs1.setEdit(true);
        workflowRequestTableFielybs1.setFieldDBType("integer");
        workflowRequestTableFielybs1.setFieldFormName("field11276");
        workflowRequestTableFielybs1.setFieldHtmlType("5");
        workflowRequestTableFielybs1.setFieldId("11276");
        workflowRequestTableFielybs1.setFieldName("bs1");
        workflowRequestTableFielybs1.setFieldOrder(9);
        workflowRequestTableFielybs1.setFieldShowName("辅料申购流程标识");
        workflowRequestTableFielybs1.setFieldShowValue("生产辅料申购");
        workflowRequestTableFielybs1.setFieldType("1");
        workflowRequestTableFielybs1.setFieldValue("0");
        workflowRequestTableFielybs1.setFiledHtmlShow("生产辅料申购");
        workflowRequestTableFielybs1.setMand(false);
        workflowRequestTableFielybs1.setView(true);
        workflowRequestTableRecord.getWorkflowRequestTableFields().add(workflowRequestTableFielybs1);
        //cgfl
        //lsh
        WorkflowRequestTableField workflowRequestTableFielsh = new WorkflowRequestTableField();
        workflowRequestTableFielsh.setEdit(true);
        workflowRequestTableFielsh.setFieldDBType("varchar2(400)");
        workflowRequestTableFielsh.setFieldFormName("field8479");
        workflowRequestTableFielsh.setFieldHtmlType("1");
        workflowRequestTableFielsh.setFieldId("8479");
        workflowRequestTableFielsh.setFieldName("lsh");
        workflowRequestTableFielsh.setFieldOrder(11);
        workflowRequestTableFielsh.setFieldShowName("流水号");
        String lsh = UUID.randomUUID().toString();
        workflowRequestTableFielsh.setFieldShowValue(lsh);//TODO
        workflowRequestTableFielsh.setFieldType("1");
        workflowRequestTableFielsh.setFieldValue(lsh);//TODO
        workflowRequestTableFielsh.setFiledHtmlShow(lsh);//TODO
        workflowRequestTableFielsh.setMand(false);
        workflowRequestTableFielsh.setView(true);
        workflowRequestTableRecord.getWorkflowRequestTableFields().add(workflowRequestTableFielsh);

        //DQNY

        WorkflowRequestTableField workflowRequestTableFiedqny = new WorkflowRequestTableField();
        workflowRequestTableFiedqny.setEdit(true);
        workflowRequestTableFiedqny.setFieldDBType("varchar2(100)");
        workflowRequestTableFiedqny.setFieldFormName("field8478");
        workflowRequestTableFiedqny.setFieldHtmlType("1");
        workflowRequestTableFiedqny.setFieldId("8478");
        workflowRequestTableFiedqny.setFieldName("DQNY");
        workflowRequestTableFiedqny.setFieldOrder(12);
        workflowRequestTableFiedqny.setFieldShowName("当期年月");//TODO
        workflowRequestTableFiedqny.setFieldShowValue("201911");//TODO
        workflowRequestTableFiedqny.setFieldType("1");
        workflowRequestTableFiedqny.setFieldValue("201911");//TODO
        workflowRequestTableFiedqny.setFiledHtmlShow("201911");//TODO
        workflowRequestTableFiedqny.setMand(false);
        workflowRequestTableFiedqny.setView(true);
        workflowRequestTableRecord.getWorkflowRequestTableFields().add(workflowRequestTableFiedqny);
        //guidang

        WorkflowRequestTableField workflowRequestTableFieguidang = new WorkflowRequestTableField();
        workflowRequestTableFieguidang.setEdit(true);
        workflowRequestTableFieguidang.setFieldDBType("integer");
        workflowRequestTableFieguidang.setFieldFormName("field8480");
        workflowRequestTableFieguidang.setFieldHtmlType("1");
        workflowRequestTableFieguidang.setFieldId("8480");
        workflowRequestTableFieguidang.setFieldName("guidang");
        workflowRequestTableFieguidang.setFieldOrder(13);
        workflowRequestTableFieguidang.setFieldShowName("归档状态");//TODO

        workflowRequestTableFieguidang.setFieldType("1");
        workflowRequestTableFieguidang.setMand(false);
        workflowRequestTableFieguidang.setView(true);
        workflowRequestTableRecord.getWorkflowRequestTableFields().add(workflowRequestTableFieguidang);

//qgdbh
        //sqr

        WorkflowRequestTableField workflowRequestTableFiesqr = new WorkflowRequestTableField();
        workflowRequestTableFiesqr.setEdit(true);
        workflowRequestTableFiesqr.setFieldDBType("integer");
        workflowRequestTableFiesqr.setFieldFormName("field8138");
        workflowRequestTableFiesqr.setFieldHtmlType("3");
        workflowRequestTableFiesqr.setFieldId("8138");
        workflowRequestTableFiesqr.setFieldName("sqr");
        workflowRequestTableFiesqr.setFieldOrder(16);
        workflowRequestTableFiesqr.setFieldShowName("申请人");
        workflowRequestTableFiesqr.setFieldShowValue(GEN02);
        workflowRequestTableFiesqr.setFieldType("1");
        workflowRequestTableFiesqr.setFieldValue(info.getUserId());
        workflowRequestTableFiesqr.setFiledHtmlShow(GEN02);
        workflowRequestTableFiesqr.setMand(false);
        workflowRequestTableFiesqr.setView(true);
        workflowRequestTableRecord.getWorkflowRequestTableFields().add(workflowRequestTableFiesqr);

//gh
        WorkflowRequestTableField workflowRequestTableFiegh = new WorkflowRequestTableField();
        workflowRequestTableFiegh.setEdit(true);
        workflowRequestTableFiegh.setFieldDBType("varchar2(400)");
        workflowRequestTableFiegh.setFieldFormName("field8139");
        workflowRequestTableFiegh.setFieldHtmlType("1");
        workflowRequestTableFiegh.setFieldId("8139");
        workflowRequestTableFiegh.setFieldName("gh");
        workflowRequestTableFiegh.setFieldOrder(19);
        workflowRequestTableFiegh.setFieldShowName("工号");
        workflowRequestTableFiegh.setFieldShowValue(TC_SQDTMODU);
        workflowRequestTableFiegh.setFieldType("1");
        workflowRequestTableFiegh.setFieldValue(TC_SQDTMODU);
        workflowRequestTableFiegh.setFiledHtmlShow(TC_SQDTMODU);
        workflowRequestTableFiegh.setMand(false);
        workflowRequestTableFiegh.setView(true);
        workflowRequestTableRecord.getWorkflowRequestTableFields().add(workflowRequestTableFiegh);
        //sqrq
        WorkflowRequestTableField workflowRequestTablesqrq = new WorkflowRequestTableField();
        workflowRequestTablesqrq.setEdit(true);
        workflowRequestTablesqrq.setFieldDBType("char(20)");
        workflowRequestTablesqrq.setFieldFormName("field8140");
        workflowRequestTablesqrq.setFieldHtmlType("3");
        workflowRequestTablesqrq.setFieldId("8140");
        workflowRequestTablesqrq.setFieldName("sqrq");
        workflowRequestTablesqrq.setFieldOrder(21);
        workflowRequestTablesqrq.setFieldShowName("申请日期");

        workflowRequestTablesqrq.setFieldShowValue(TC_SQDT07);
        workflowRequestTablesqrq.setFieldType("2");
        workflowRequestTablesqrq.setFieldValue(TC_SQDT07);
        workflowRequestTablesqrq.setFiledHtmlShow(TC_SQDT07);
        workflowRequestTablesqrq.setMand(false);
        workflowRequestTablesqrq.setView(true);
        workflowRequestTableRecord.getWorkflowRequestTableFields().add(workflowRequestTablesqrq);
        //TODO sqbm
        WorkflowRequestTableField workflowRequestTablesqbm = new WorkflowRequestTableField();
        workflowRequestTablesqbm.setEdit(true);
        workflowRequestTablesqbm.setFieldDBType("integer");
        workflowRequestTablesqbm.setFieldFormName("field8141");
        workflowRequestTablesqbm.setFieldHtmlType("3");
        workflowRequestTablesqbm.setFieldId("8141");
        workflowRequestTablesqbm.setFieldName("sqbm");
        workflowRequestTablesqbm.setFieldOrder(23);
        workflowRequestTablesqbm.setFieldShowName("申请部门");
        //logger.debug(sqdt.get("TC_SQDTMODU").toString());
      /* HashMap   depttemp =  imaFileMapper.selectDeptByCode(sqdt.get("TC_SQDTMODU").toString());
        String dept1 =(depttemp!=null)&&(depttemp.get("TC_OADEPTID")!=null)? depttemp.get("TC_OADEPTID").toString(): "无";
        logger.debug(dept1);
    if ("无".equals(dept1)){
    return "-11";
        }*/
        workflowRequestTablesqbm.setFieldShowValue(SQBM);
        workflowRequestTablesqbm.setFieldType("4");
        workflowRequestTablesqbm.setFieldValue(SQBM);
        workflowRequestTablesqbm.setFiledHtmlShow(SQBM);
        workflowRequestTablesqbm.setMand(false);
        workflowRequestTablesqbm.setView(true);
        workflowRequestTableRecord.getWorkflowRequestTableFields().add(workflowRequestTablesqbm);
        //TODO fjh
        WorkflowRequestTableField workflowRequestTablefjh = new WorkflowRequestTableField();
        workflowRequestTablefjh.setEdit(true);
        workflowRequestTablefjh.setFieldDBType("varchar2(400)");
        workflowRequestTablefjh.setFieldFormName("field8142");
        workflowRequestTablefjh.setFieldHtmlType("1");
        workflowRequestTablefjh.setFieldId("8142");
        workflowRequestTablefjh.setFieldName("fjh");
        workflowRequestTablefjh.setFieldOrder(25);
        workflowRequestTablefjh.setFieldShowName("分机号");
        workflowRequestTablefjh.setFieldShowValue(FENJIHAO);
        workflowRequestTablefjh.setFieldType("1");
        workflowRequestTablefjh.setFieldValue(FENJIHAO);
        workflowRequestTablefjh.setFiledHtmlShow(FENJIHAO);
        workflowRequestTablefjh.setMand(false);
        workflowRequestTablefjh.setView(true);
        workflowRequestTableRecord.getWorkflowRequestTableFields().add(workflowRequestTablefjh);
        //TODO sqsy
        WorkflowRequestTableField workflowRequestTablesqsy = new WorkflowRequestTableField();
        workflowRequestTablesqsy.setEdit(true);
        workflowRequestTablesqsy.setFieldDBType("varchar2(4000)");
        workflowRequestTablesqsy.setFieldFormName("field8146");
        workflowRequestTablesqsy.setFieldHtmlType("2");
        workflowRequestTablesqsy.setFieldId("8146");
        workflowRequestTablesqsy.setFieldName("sqsy");
        workflowRequestTablesqsy.setFieldOrder(30);
        workflowRequestTablesqsy.setFieldShowName("申请事由");
        workflowRequestTablesqsy.setFieldShowValue(TC_SQDT06);
        workflowRequestTablesqsy.setFieldType("1");
        workflowRequestTablesqsy.setFieldValue(TC_SQDT06);
        workflowRequestTablesqsy.setFiledHtmlShow(TC_SQDT06);
        workflowRequestTablesqsy.setMand(false);
        workflowRequestTablesqsy.setView(true);
        workflowRequestTableRecord.getWorkflowRequestTableFields().add(workflowRequestTablesqsy);
        //ssgs
        WorkflowRequestTableField workflowRequestTablessgs = new WorkflowRequestTableField();
        workflowRequestTablessgs.setEdit(true);
        workflowRequestTablessgs.setFieldDBType("integer");
        workflowRequestTablessgs.setFieldFormName("field8149");
        workflowRequestTablessgs.setFieldHtmlType("5");
        workflowRequestTablessgs.setFieldId("8149");
        workflowRequestTablessgs.setFieldName("ssgs");
        workflowRequestTablessgs.setFieldOrder(36);
        workflowRequestTablessgs.setFieldShowName("所属公司");
        //TODO
        String ssgs = "";
        if ("DS2".equals(ds)){
            ssgs = "1";
        }else {
            ssgs = "0";
        }
        workflowRequestTablessgs.setFieldShowValue(ssgs);
        workflowRequestTablessgs.setFieldType(ssgs);
        workflowRequestTablessgs.setFieldValue(ssgs);
        workflowRequestTablessgs.setFiledHtmlShow(ssgs);
        workflowRequestTablessgs.setMand(true);
        workflowRequestTablessgs.setView(true);
        workflowRequestTableRecord.getWorkflowRequestTableFields().add(workflowRequestTablessgs);

//bycgje
        WorkflowRequestTableField workflowRequestTablebycgje = new WorkflowRequestTableField();
        workflowRequestTablebycgje.setEdit(true);
        workflowRequestTablebycgje.setFieldDBType("number(15,2)");
        workflowRequestTablebycgje.setFieldFormName("field8150");
        workflowRequestTablebycgje.setFieldHtmlType("1");
        workflowRequestTablebycgje.setFieldId("8150");
        workflowRequestTablebycgje.setFieldName("bycgje");
        workflowRequestTablebycgje.setFieldOrder(38);
        workflowRequestTablebycgje.setFieldShowName("本月已采购金额");//TODO

        String bycgjesum =  imaFileMapper.sumMonth(workshop,purchase,0);
        workflowRequestTablebycgje.setFieldShowValue(bycgjesum);
        workflowRequestTablebycgje.setFieldType("3");
        workflowRequestTablebycgje.setFieldValue(bycgjesum);
        workflowRequestTablebycgje.setFiledHtmlShow(bycgjesum);
        workflowRequestTablebycgje.setMand(false);
        workflowRequestTablebycgje.setView(true);
        workflowRequestTableRecord.getWorkflowRequestTableFields().add(workflowRequestTablebycgje);
        //sycgje

        WorkflowRequestTableField workflowRequestTablesycgje = new WorkflowRequestTableField();
        workflowRequestTablesycgje.setEdit(true);
        workflowRequestTablesycgje.setFieldDBType("number(15,2)");
        workflowRequestTablesycgje.setFieldFormName("field8151");
        workflowRequestTablesycgje.setFieldHtmlType("1");
        workflowRequestTablesycgje.setFieldId("8151");
        workflowRequestTablesycgje.setFieldName("sycgje");
        workflowRequestTablesycgje.setFieldOrder(39);
        workflowRequestTablesycgje.setFieldShowName("上月采购金额");//TODO
        String sycgjesum =  imaFileMapper.sumMonth(workshop,purchase,-1);
        workflowRequestTablesycgje.setFieldShowValue(sycgjesum);
        workflowRequestTablesycgje.setFieldType("3");
        workflowRequestTablesycgje.setFieldValue(sycgjesum);
        workflowRequestTablesycgje.setFiledHtmlShow(sycgjesum);
        workflowRequestTablesycgje.setMand(false);
        workflowRequestTablesycgje.setView(true);
        workflowRequestTableRecord.getWorkflowRequestTableFields().add(workflowRequestTablesycgje);
//ssycgje

        WorkflowRequestTableField workflowRequestTablessycgje = new WorkflowRequestTableField();
        workflowRequestTablessycgje.setEdit(true);
        workflowRequestTablessycgje.setFieldDBType("number(15,2)");
        workflowRequestTablessycgje.setFieldFormName("field8152");
        workflowRequestTablessycgje.setFieldHtmlType("1");
        workflowRequestTablessycgje.setFieldId("8152");
        workflowRequestTablessycgje.setFieldName("ssycgje");
        workflowRequestTablessycgje.setFieldOrder(42);
        workflowRequestTablessycgje.setFieldShowName("上上月采购金额");//TODO
        String ssycgjesum = imaFileMapper.sumMonth(workshop,purchase,-2);
        workflowRequestTablessycgje.setFieldShowValue(ssycgjesum);
        workflowRequestTablessycgje.setFieldType("3");
        workflowRequestTablessycgje.setFieldValue(ssycgjesum);
        workflowRequestTablessycgje.setFiledHtmlShow(ssycgjesum);
        workflowRequestTablessycgje.setMand(false);
        workflowRequestTablessycgje.setView(true);
        workflowRequestTableRecord.getWorkflowRequestTableFields().add(workflowRequestTablessycgje);

//cgbm
        WorkflowRequestTableField workflowRequestTablecgbm = new WorkflowRequestTableField();
        workflowRequestTablecgbm.setEdit(true);
        workflowRequestTablecgbm.setFieldDBType("brower.cgbm");
        workflowRequestTablecgbm.setFieldFormName("field8621");
        workflowRequestTablecgbm.setFieldHtmlType("3");
        workflowRequestTablecgbm.setFieldId("8621");
        workflowRequestTablecgbm.setFieldName("cgbm");
        workflowRequestTablecgbm.setFieldOrder(45);
        workflowRequestTablecgbm.setFieldShowName("采购部门");
        workflowRequestTablecgbm.setFieldShowValue("采购部门");
        workflowRequestTablecgbm.setFieldType("161");
        workflowRequestTablecgbm.setFieldValue(OADEPTID);

        workflowRequestTablecgbm.setFiledHtmlShow("采购部门");
        workflowRequestTablecgbm.setMand(true);
        workflowRequestTablecgbm.setView(true);
        workflowRequestTableRecord.getWorkflowRequestTableFields().add(workflowRequestTablecgbm);
//scerpbm
        WorkflowRequestTableField workflowRequestTablescerpbm = new WorkflowRequestTableField();
        workflowRequestTablescerpbm.setEdit(true);
        workflowRequestTablescerpbm.setFieldDBType("brower.scerpbm");
        workflowRequestTablescerpbm.setFieldFormName("field11290");
        workflowRequestTablescerpbm.setFieldHtmlType("3");
        workflowRequestTablescerpbm.setFieldId("11290");
        workflowRequestTablescerpbm.setFieldName("scerpbm");
        workflowRequestTablescerpbm.setFieldOrder(47);
        workflowRequestTablescerpbm.setFieldShowName("ERP部门编码");//TODO
        workflowRequestTablescerpbm.setFieldShowValue(workshop);
        workflowRequestTablescerpbm.setFieldType("161");
        workflowRequestTablescerpbm.setFieldValue(workshop);
        workflowRequestTablescerpbm.setFiledHtmlShow(workshop);
        workflowRequestTablescerpbm.setMand(false);
        workflowRequestTablescerpbm.setView(false);
        workflowRequestTableRecord.getWorkflowRequestTableFields().add(workflowRequestTablescerpbm);
        //zjsj
        WorkflowRequestTableField workflowRequestTablezjsj = new WorkflowRequestTableField();
        workflowRequestTablezjsj.setEdit(true);
        workflowRequestTablezjsj.setFieldDBType("integer");
        workflowRequestTablezjsj.setFieldFormName("field13473");
        workflowRequestTablezjsj.setFieldHtmlType("3");
        workflowRequestTablezjsj.setFieldId("13473");
        workflowRequestTablezjsj.setFieldName("zjsj");
        workflowRequestTablezjsj.setFieldOrder(48);
        workflowRequestTablezjsj.setFieldShowName("你的直接上级");//TODO
        workflowRequestTablezjsj.setFieldShowValue("ERP没有维护");
        workflowRequestTablezjsj.setFieldType("1");
        workflowRequestTablezjsj.setFieldType(info.getUserId());
        workflowRequestTablezjsj.setFiledHtmlShow("ERP没有维护");
        workflowRequestTablezjsj.setMand(true);
        workflowRequestTablezjsj.setView(true);
        //TODO 当前某某车间某某采购部门

      /*  int sqdscount = imaFileMapper.count(sqId, ds,  workshop,  purchase, v_gmisc);
        if (sqdscount==0){
            return  "-10";
        }*/
        logger.debug("sqId="+sqId+"ds="+ds+"workshop="+workshop+"purchase="+purchase+"v_gmisc="+v_gmisc);
        List<Map<String, Object>> sqdsList = imaFileMapper.querySqDsByIdEquipment(sqId,ds,  workshop,  purchase, v_gmisc);
        logger.debug(JSON.toJSONString(sqdsList));
        if (CollectionUtils.isEmpty(sqdsList)){
            return "-20";
        }

        //TODO erpbmbm
        WorkflowRequestTableField workflowRequestTableerpbmbm = new WorkflowRequestTableField();
        workflowRequestTableerpbmbm.setEdit(true);
        workflowRequestTableerpbmbm.setFieldDBType("brower.erpbm");
        workflowRequestTableerpbmbm.setFieldFormName("field8520");
        workflowRequestTableerpbmbm.setFieldHtmlType("3");
        workflowRequestTableerpbmbm.setFieldId("8520");
        workflowRequestTableerpbmbm.setFieldName("erpbmbm");
        workflowRequestTableerpbmbm.setFieldOrder(44);
        workflowRequestTableerpbmbm.setFieldShowName("ERP部门编码");
        workflowRequestTableerpbmbm.setFieldType("161");
        String tc_sqds10 = sqdsList.get(0).get("TC_SQDS10")!=null?sqdsList.get(0).get("TC_SQDS10").toString(): "无";
        String depName =  imaFileMapper.queryCheById(tc_sqds10);
        workflowRequestTableerpbmbm.setFieldShowValue(tc_sqds10);
        workflowRequestTableerpbmbm.setFieldValue(tc_sqds10);
        workflowRequestTableerpbmbm.setFiledHtmlShow(tc_sqds10);
        workflowRequestTableerpbmbm.setMand(true);
        workflowRequestTableerpbmbm.setView(true);
        workflowRequestTableRecord.getWorkflowRequestTableFields().add(workflowRequestTableerpbmbm);
        // fybm
        WorkflowRequestTableField workflowRequestTablefybm = new WorkflowRequestTableField();
        workflowRequestTablefybm.setEdit(true);
        workflowRequestTablefybm.setFieldDBType("varchar2(400)");
        workflowRequestTablefybm.setFieldFormName("field8173");
        workflowRequestTablefybm.setFieldHtmlType("1");
        workflowRequestTablefybm.setFieldId("8173");
        workflowRequestTablefybm.setFieldName("fybm");
        workflowRequestTablefybm.setFieldOrder(28);
        workflowRequestTablefybm.setFieldShowName(depName);
        workflowRequestTablefybm.setFieldShowValue(depName);
        workflowRequestTablefybm.setFieldType("1");
        workflowRequestTablefybm.setFieldValue(depName);
        workflowRequestTablefybm.setFiledHtmlShow(depName);
        workflowRequestTablefybm.setMand(false);
        workflowRequestTablefybm.setView(true);
        workflowRequestTableRecord.getWorkflowRequestTableFields().add(workflowRequestTablefybm);
        // qgdsqdb
        WorkflowRequestTableField workflowRequestTableqgdsqdb = new WorkflowRequestTableField();
        workflowRequestTableqgdsqdb.setEdit(true);
        workflowRequestTableqgdsqdb.setFieldDBType("INTEGER");
        workflowRequestTableqgdsqdb.setFieldFormName("field32090");
        workflowRequestTableqgdsqdb.setFieldHtmlType("1");
        workflowRequestTableqgdsqdb.setFieldId("32090");
        workflowRequestTableqgdsqdb.setFieldName("qgdsqdb");
        workflowRequestTableqgdsqdb.setFieldOrder(28);
        workflowRequestTableqgdsqdb.setFieldShowName(TC_SQDT03);
        workflowRequestTableqgdsqdb.setFieldShowValue(TC_SQDT03);
        workflowRequestTableqgdsqdb.setFieldType(TC_SQDT03);
        workflowRequestTableqgdsqdb.setFieldValue(TC_SQDT03);
        workflowRequestTableqgdsqdb.setFiledHtmlShow(TC_SQDT03);
        workflowRequestTableqgdsqdb.setMand(false);
        workflowRequestTableqgdsqdb.setView(true);
        workflowRequestTableRecord.getWorkflowRequestTableFields().add(workflowRequestTableqgdsqdb);
        workflowRequestTableRecord.getWorkflowRequestTableFields().add(workflowRequestTablezjsj);
        //
        workflowMainTableInfo.getRequestRecords().add(workflowRequestTableRecord);
        // doCreateWorkflowRequest.setCreateUserId(Integer.valueOf(info.getUserId()));
        // 0准备中，1流程创建，2创建成功，3，创建失败，4撤单中，5撤单成功
        //workflowDetailTableInfos
        WorkflowDetailTableInfo workflowDetailTableInfos = new WorkflowDetailTableInfo();
        for(int i=0 ; i<=sqdsList.size()-1; i++)
        {
            //workflowRequestTableRecords
            WorkflowRequestTableRecord workflowRequestTableRecords = new WorkflowRequestTableRecord();
            workflowRequestTableRecords.setRecordOrder(i);

            //workflowRequestTableField
            //TODO 料件编号
            //   <edit>true</edit>
            //                     <fieldDBType>browser.wlxx</fieldDBType>
            //                     <fieldFormName>field8295</fieldFormName>
            //                     <fieldHtmlType>3</fieldHtmlType>
            //                     <fieldId>8295</fieldId>
            //                     <fieldName>ljbm</fieldName>
            //                     <fieldOrder>0</fieldOrder>
            //                     <fieldShowName>料件编码</fieldShowName>
            //                     <fieldShowValue>&lt;a title='OAXZ000620'>OAXZ000620&lt;/a>&amp;nbsp</fieldShowValue>
            //                     <fieldType>161</fieldType>
            //                     <fieldValue>OAXZ000620</fieldValue>
            //                     <filedHtmlShow>&lt;div style="width:100%;">&lt;a title='OAXZ000620'>OAXZ000620&lt;/a>&amp;nbsp&lt;/div></filedHtmlShow>
            //                     <mand>true</mand>
            //                     <view>true</view>
            WorkflowRequestTableField workflowRequestTableFieldtc_sqds03 = new WorkflowRequestTableField();
            workflowRequestTableFieldtc_sqds03.setEdit(true);
            workflowRequestTableFieldtc_sqds03.setFieldDBType("varchar2(500)");
            //workflowRequestTableFieldtc_sqds03.setFieldFormName("field46969");
            workflowRequestTableFieldtc_sqds03.setFieldFormName("field8295");
            workflowRequestTableFieldtc_sqds03.setFieldHtmlType("3");
            //  workflowRequestTableFieldtc_sqds03.setFieldId("46969");
            workflowRequestTableFieldtc_sqds03.setFieldId("8295");
            //  workflowRequestTableFieldtc_sqds03.setFieldName("ljbmwb");
            workflowRequestTableFieldtc_sqds03.setFieldName("xljbm");//20200107
            workflowRequestTableFieldtc_sqds03.setFieldOrder(0);
            workflowRequestTableFieldtc_sqds03.setFieldShowName("料件编码");
            String TC_SQDS03 = sqdsList.get(i).get("TC_SQDS03")!=null?sqdsList.get(i).get("TC_SQDS03").toString(): "无";

            workflowRequestTableFieldtc_sqds03.setFieldShowValue(TC_SQDS03);// TODO &lt;a title='OAXZ000620'>OAXZ000620&lt;/a>&amp;nbsp
            workflowRequestTableFieldtc_sqds03.setFieldType("161");
            workflowRequestTableFieldtc_sqds03.setFieldValue(TC_SQDS03);
            workflowRequestTableFieldtc_sqds03.setFiledHtmlShow(TC_SQDS03);//TODO &lt;div style="width:100%;">&lt;a title='OAXZ000620'>OAXZ000620&lt;/a>&amp;nbsp&lt;/div>
            workflowRequestTableFieldtc_sqds03.setMand(true);
            workflowRequestTableFieldtc_sqds03.setView(true);
            workflowRequestTableRecords.getWorkflowRequestTableFields().add(workflowRequestTableFieldtc_sqds03);
            //TODO 料件名称
            //   <edit>true</edit>
            //                     <fieldDBType>varchar2(400)</fieldDBType>
            //                     <fieldFormName>field8154</fieldFormName>
            //                     <fieldHtmlType>1</fieldHtmlType>
            //                     <fieldId>8154</fieldId>
            //                     <fieldName>pm</fieldName>
            //                     <fieldOrder>0</fieldOrder>
            //                     <fieldShowName>品名</fieldShowName>
            //                     <fieldShowValue>不锈钢游标卡尺&amp;lt;1330&amp;gt; 艾瑞泽</fieldShowValue>
            //                     <fieldType>1</fieldType>
            //                     <fieldValue>不锈钢游标卡尺&amp;lt;1330&amp;gt; 艾瑞泽</fieldValue>
            //                     <filedHtmlShow>不锈钢游标卡尺&amp;lt;1330&amp;gt; 艾瑞泽</filedHtmlShow>
            //                     <mand>false</mand>
            //                     <view>true</view>
            WorkflowRequestTableField workflowRequestTableFieldtc_sqds04 = new WorkflowRequestTableField();
            workflowRequestTableFieldtc_sqds04.setEdit(true);
            workflowRequestTableFieldtc_sqds04.setFieldDBType("varchar2(400)");
            workflowRequestTableFieldtc_sqds04.setFieldFormName("field8154");
            workflowRequestTableFieldtc_sqds04.setFieldHtmlType("1");
            workflowRequestTableFieldtc_sqds04.setFieldId("8154");//ljbm
            workflowRequestTableFieldtc_sqds04.setFieldName("pm");
            workflowRequestTableFieldtc_sqds04.setFieldOrder(0);
            workflowRequestTableFieldtc_sqds04.setFieldShowName("品名");
            String TC_SQDS04 = sqdsList.get(i).get("TC_SQDS04")!=null?sqdsList.get(i).get("TC_SQDS04").toString():"无";
            workflowRequestTableFieldtc_sqds04.setFieldShowValue(TC_SQDS04);//<fieldShowValue>不锈钢游标卡尺&amp;lt;1330&amp;gt; 艾瑞泽</fieldShowValue>
            workflowRequestTableFieldtc_sqds04.setFieldType("1");
            workflowRequestTableFieldtc_sqds04.setFieldValue(TC_SQDS04);//<fieldValue>不锈钢游标卡尺&amp;lt;1330&amp;gt; 艾瑞泽</fieldValue>
            workflowRequestTableFieldtc_sqds04.setFiledHtmlShow(TC_SQDS04);// <filedHtmlShow>不锈钢游标卡尺&amp;lt;1330&amp;gt; 艾瑞泽</filedHtmlShow>
            workflowRequestTableFieldtc_sqds04.setMand(false);
            workflowRequestTableFieldtc_sqds04.setView(true);
            workflowRequestTableRecords.getWorkflowRequestTableFields().add(workflowRequestTableFieldtc_sqds04);

            //TODO 规格
            //
            //                     <edit>true</edit>
            //                     <fieldDBType>varchar2(400)</fieldDBType>
            //                     <fieldFormName>field8155</fieldFormName>
            //                     <fieldHtmlType>1</fieldHtmlType>
            //                     <fieldId>8155</fieldId>
            //                     <fieldName>gg</fieldName>
            //                     <fieldOrder>0</fieldOrder>
            //                     <fieldShowName>规格</fieldShowName>
            //                     <fieldShowValue>&amp;lt;1330&amp;gt;</fieldShowValue>
            //                     <fieldType>1</fieldType>
            //                     <fieldValue>&amp;lt;1330&amp;gt;</fieldValue>
            //                     <filedHtmlShow>&amp;lt;1330&amp;gt;</filedHtmlShow>
            //                     <mand>false</mand>
            //                     <view>true</view>
            WorkflowRequestTableField workflowRequestTableFieldtc_sqds05 = new WorkflowRequestTableField();
            workflowRequestTableFieldtc_sqds05.setEdit(true);
            workflowRequestTableFieldtc_sqds05.setFieldDBType("varchar2(400)");
            workflowRequestTableFieldtc_sqds05.setFieldFormName("field8155");
            workflowRequestTableFieldtc_sqds05.setFieldHtmlType("1");
            workflowRequestTableFieldtc_sqds05.setFieldId("8155");
            workflowRequestTableFieldtc_sqds05.setFieldName("gg");
            workflowRequestTableFieldtc_sqds05.setFieldOrder(0);
            workflowRequestTableFieldtc_sqds05.setFieldShowName("规格");
            String TC_SQDS05 =  sqdsList.get(i).get("TC_SQDS05")!=null?sqdsList.get(i).get("TC_SQDS05").toString():"无";
            workflowRequestTableFieldtc_sqds05.setFieldShowValue(TC_SQDS05);
            workflowRequestTableFieldtc_sqds05.setFieldType("1");
            workflowRequestTableFieldtc_sqds05.setFieldValue(TC_SQDS05);
            workflowRequestTableFieldtc_sqds05.setFiledHtmlShow(TC_SQDS05);
            workflowRequestTableFieldtc_sqds05.setMand(false);
            workflowRequestTableFieldtc_sqds05.setView(true);
            workflowRequestTableRecords.getWorkflowRequestTableFields().add(workflowRequestTableFieldtc_sqds05);
            //TODO 单位
            //   <edit>true</edit>
            //                     <fieldDBType>varchar2(400)</fieldDBType>
            //                     <fieldFormName>field8156</fieldFormName>
            //                     <fieldHtmlType>1</fieldHtmlType>
            //                     <fieldId>8156</fieldId>
            //                     <fieldName>dw</fieldName>
            //                     <fieldOrder>0</fieldOrder>
            //                     <fieldShowName>单位</fieldShowName>
            //                     <fieldShowValue>PCS</fieldShowValue>
            //                     <fieldType>1</fieldType>
            //                     <fieldValue>PCS</fieldValue>
            //                     <filedHtmlShow>PCS</filedHtmlShow>
            //                     <mand>false</mand>
            //                     <view>true</view>
            WorkflowRequestTableField workflowRequestTableFieldtc_sqds06 = new WorkflowRequestTableField();
            workflowRequestTableFieldtc_sqds06.setEdit(true);
            workflowRequestTableFieldtc_sqds06.setFieldDBType("varchar2(400)");
            workflowRequestTableFieldtc_sqds06.setFieldShowName("field8156");
            workflowRequestTableFieldtc_sqds06.setFieldHtmlType("1");
            workflowRequestTableFieldtc_sqds06.setFieldId("8156");
            workflowRequestTableFieldtc_sqds06.setFieldName("dw");
            workflowRequestTableFieldtc_sqds06.setFieldOrder(0);
            workflowRequestTableFieldtc_sqds06.setFieldShowName("单位");
            String TC_SQDS06 = sqdsList.get(i).get("TC_SQDS06")!=null?sqdsList.get(i).get("TC_SQDS06").toString():"无";
            workflowRequestTableFieldtc_sqds06.setFieldShowName(TC_SQDS06);
            workflowRequestTableFieldtc_sqds06.setFieldType("1");
            workflowRequestTableFieldtc_sqds06.setFieldValue(TC_SQDS06);
            workflowRequestTableFieldtc_sqds06.setFiledHtmlShow(TC_SQDS06);
            workflowRequestTableFieldtc_sqds06.setMand(false);
            workflowRequestTableFieldtc_sqds06.setView(true);
            workflowRequestTableRecords.getWorkflowRequestTableFields().add(workflowRequestTableFieldtc_sqds06);
            //TODO 单价tc_sqds07
            //  <edit>true</edit>
            //                     <fieldDBType>number(15,3)</fieldDBType>
            //                     <fieldFormName>field8157</fieldFormName>
            //                     <fieldHtmlType>1</fieldHtmlType>
            //                     <fieldId>8157</fieldId>
            //                     <fieldName>dj</fieldName>
            //                     <fieldOrder>0</fieldOrder>
            //                     <fieldShowName>单价</fieldShowName>
            //                     <fieldShowValue>66</fieldShowValue>
            //                     <fieldType>3</fieldType>
            //                     <fieldValue>66</fieldValue>
            //                     <filedHtmlShow>66</filedHtmlShow>
            //                     <mand>false</mand>
            //                     <view>true</view>
            WorkflowRequestTableField workflowRequestTableFieldtc_sqds07 = new WorkflowRequestTableField();
            workflowRequestTableFieldtc_sqds07.setEdit(true);
            workflowRequestTableFieldtc_sqds07.setFieldDBType("number(15,3)");
            workflowRequestTableFieldtc_sqds07.setFieldFormName("field8157");
            workflowRequestTableFieldtc_sqds07.setFieldHtmlType("1");
            workflowRequestTableFieldtc_sqds07.setFieldId("8157");
            workflowRequestTableFieldtc_sqds07.setFieldName("dj");
            workflowRequestTableFieldtc_sqds07.setFieldOrder(0);
            workflowRequestTableFieldtc_sqds07.setFieldShowName("单价");
            String TC_SQDS07 = sqdsList.get(i).get("TC_SQDS07")!=null?sqdsList.get(i).get("TC_SQDS07").toString():"0.00";
            workflowRequestTableFieldtc_sqds07.setFieldShowValue(TC_SQDS07);
            workflowRequestTableFieldtc_sqds07.setFieldType("3");
            workflowRequestTableFieldtc_sqds07.setFieldValue(TC_SQDS07);
            workflowRequestTableFieldtc_sqds07.setFiledHtmlShow(TC_SQDS07);
            workflowRequestTableFieldtc_sqds07.setMand(false);
            workflowRequestTableFieldtc_sqds07.setView(true);
            workflowRequestTableRecords.getWorkflowRequestTableFields().add(workflowRequestTableFieldtc_sqds07);
            //TODO 数量tc_sqds11
            // <edit>true</edit>
            //                     <fieldDBType>number(15,3)</fieldDBType>
            //                     <fieldFormName>field8158</fieldFormName>
            //                     <fieldHtmlType>1</fieldHtmlType>
            //                     <fieldId>8158</fieldId>
            //                     <fieldName>sl</fieldName>
            //                     <fieldOrder>0</fieldOrder>
            //                     <fieldShowName>数量</fieldShowName>
            //                     <fieldShowValue>1212</fieldShowValue>
            //                     <fieldType>3</fieldType>
            //                     <fieldValue>1212</fieldValue>
            //                     <filedHtmlShow>1212</filedHtmlShow>
            //                     <mand>true</mand>
            //                     <view>true</view>
            WorkflowRequestTableField workflowRequestTableFieldtc_sqds11 = new WorkflowRequestTableField();
            workflowRequestTableFieldtc_sqds11.setEdit(true);
            workflowRequestTableFieldtc_sqds11.setFieldDBType("number(15,3)");
            workflowRequestTableFieldtc_sqds11.setFieldFormName("field8158");
            workflowRequestTableFieldtc_sqds11.setFieldHtmlType("1");
            workflowRequestTableFieldtc_sqds11.setFieldId("8158");
            workflowRequestTableFieldtc_sqds11.setFieldName("sl");
            workflowRequestTableFieldtc_sqds11.setFieldOrder(0);
            workflowRequestTableFieldtc_sqds11.setFieldShowName("数量");
            String TC_SQDS11 = sqdsList.get(i).get("TC_SQDS11")!=null ?sqdsList.get(i).get("TC_SQDS11").toString():"0.00";
            workflowRequestTableFieldtc_sqds11.setFieldShowValue(TC_SQDS11);
            workflowRequestTableFieldtc_sqds11.setFieldType("3");
            workflowRequestTableFieldtc_sqds11.setFieldValue(TC_SQDS11);
            workflowRequestTableFieldtc_sqds11.setFiledHtmlShow(TC_SQDS11);
            workflowRequestTableFieldtc_sqds11.setMand(false);
            workflowRequestTableFieldtc_sqds11.setView(true);
            workflowRequestTableRecords.getWorkflowRequestTableFields().add(workflowRequestTableFieldtc_sqds11);
            //TODO 总价tc_sqds12
            //  <edit>true</edit>
            //                     <fieldDBType>number(15,2)</fieldDBType>
            //                     <fieldFormName>field8159</fieldFormName>
            //                     <fieldHtmlType>1</fieldHtmlType>
            //                     <fieldId>8159</fieldId>
            //                     <fieldName>zj</fieldName>
            //                     <fieldOrder>0</fieldOrder>
            //                     <fieldShowName>总价</fieldShowName>
            //                     <fieldShowValue>79992</fieldShowValue>
            //                     <fieldType>3</fieldType>
            //                     <fieldValue>79992</fieldValue>
            //                     <filedHtmlShow>79992</filedHtmlShow>
            //                     <mand>false</mand>
            //                     <view>true</view>

            WorkflowRequestTableField workflowRequestTableFieldtc_sqds12 = new WorkflowRequestTableField();
            workflowRequestTableFieldtc_sqds12.setEdit(true);
            workflowRequestTableFieldtc_sqds12.setFieldDBType("number(15,3)");
            workflowRequestTableFieldtc_sqds12.setFieldFormName("field8159");
            workflowRequestTableFieldtc_sqds12.setFieldHtmlType("1");
            workflowRequestTableFieldtc_sqds12.setFieldId("8159");
            workflowRequestTableFieldtc_sqds12.setFieldName("zj");
            workflowRequestTableFieldtc_sqds12.setFieldOrder(0);
            workflowRequestTableFieldtc_sqds12.setFieldShowName("总价");
            String TC_SQDS12 = sqdsList.get(i).get("TC_SQDS12")!=null ? sqdsList.get(i).get("TC_SQDS12").toString() :"0.00";
            workflowRequestTableFieldtc_sqds12.setFieldShowValue(TC_SQDS12);
            workflowRequestTableFieldtc_sqds12.setFieldType("3");
            workflowRequestTableFieldtc_sqds12.setFieldValue(TC_SQDS12);
            workflowRequestTableFieldtc_sqds12.setFiledHtmlShow(TC_SQDS12);
            workflowRequestTableFieldtc_sqds12.setMand(false);
            workflowRequestTableFieldtc_sqds12.setView(true);
            workflowRequestTableRecords.getWorkflowRequestTableFields().add(workflowRequestTableFieldtc_sqds12);
            // TODO 本月已采购数量 tc_sqds13
            // <edit>true</edit>
            //                     <fieldDBType>number(15,3)</fieldDBType>
            //                     <fieldFormName>field8160</fieldFormName>
            //                     <fieldHtmlType>1</fieldHtmlType>
            //                     <fieldId>8160</fieldId>
            //                     <fieldName>bycgsl</fieldName>
            //                     <fieldOrder>0</fieldOrder>
            //                     <fieldShowName>本月已采购数量</fieldShowName>
            //                     <fieldShowValue>0</fieldShowValue>
            //                     <fieldType>3</fieldType>
            //                     <fieldValue>0</fieldValue>
            //                     <filedHtmlShow>0</filedHtmlShow>
            //                     <mand>false</mand>
            //                     <view>true</view>

            WorkflowRequestTableField workflowRequestTableFieldtc_sqds13 = new WorkflowRequestTableField();
            workflowRequestTableFieldtc_sqds13.setEdit(true);
            workflowRequestTableFieldtc_sqds13.setFieldDBType("number(15,3)");
            workflowRequestTableFieldtc_sqds13.setFieldFormName("field8160");
            workflowRequestTableFieldtc_sqds13.setFieldHtmlType("1");
            workflowRequestTableFieldtc_sqds13.setFieldId("8160");
            workflowRequestTableFieldtc_sqds13.setFieldName("bycgsl");
            workflowRequestTableFieldtc_sqds13.setFieldOrder(0);
            workflowRequestTableFieldtc_sqds13.setFieldShowName("本月已采购数量");
            String TC_SQDS13 = sqdsList.get(i).get("TC_SQDS13")!=null?sqdsList.get(i).get("TC_SQDS13").toString():"0.00";
            workflowRequestTableFieldtc_sqds13.setFieldShowValue(TC_SQDS13);
            workflowRequestTableFieldtc_sqds13.setFieldType("3");
            workflowRequestTableFieldtc_sqds13.setFieldValue(TC_SQDS13);
            workflowRequestTableFieldtc_sqds13.setFiledHtmlShow(TC_SQDS13);
            workflowRequestTableFieldtc_sqds13.setMand(false);
            workflowRequestTableFieldtc_sqds13.setView(true);
            workflowRequestTableRecords.getWorkflowRequestTableFields().add(workflowRequestTableFieldtc_sqds13);
            //    定额数量
            //                     <edit>true</edit>
            //                     <fieldDBType>number(15,3)</fieldDBType>
            //                     <fieldFormName>field8161</fieldFormName>
            //                     <fieldHtmlType>1</fieldHtmlType>
            //                     <fieldId>8161</fieldId>
            //                     <fieldName>desl</fieldName>
            //                     <fieldOrder>0</fieldOrder>
            //                     <fieldShowName>定额数量</fieldShowName>
            //                     <fieldShowValue>0</fieldShowValue>
            //                     <fieldType>3</fieldType>
            //                     <fieldValue>0</fieldValue>
            //                     <filedHtmlShow>0</filedHtmlShow>
            //                     <mand>false</mand>
            //                     <view>true</view>
            WorkflowRequestTableField workflowRequestTableFielddinge = new WorkflowRequestTableField();
            workflowRequestTableFielddinge.setEdit(true);
            workflowRequestTableFielddinge.setFieldDBType("number(15,3)");
            workflowRequestTableFielddinge.setFieldFormName("field8161");
            workflowRequestTableFielddinge.setFieldHtmlType("1");
            workflowRequestTableFielddinge.setFieldId("8161");
            workflowRequestTableFielddinge.setFieldName("desl");
            workflowRequestTableFielddinge.setFieldOrder(0);
            workflowRequestTableFielddinge.setFieldShowName("定额数量");
            workflowRequestTableFielddinge.setFieldShowValue("0");
            workflowRequestTableFielddinge.setFieldType("3");
            workflowRequestTableFielddinge.setFieldValue("0");
            workflowRequestTableFielddinge.setFiledHtmlShow("0");
            workflowRequestTableFielddinge.setMand(false);
            workflowRequestTableFielddinge.setView(true);
            workflowRequestTableRecords.getWorkflowRequestTableFields().add(workflowRequestTableFielddinge);

            //TODO
            //                     <edit>true</edit>
            //                     <fieldDBType>number(15,3)</fieldDBType>
            //                     <fieldFormName>field8162</fieldFormName>
            //                     <fieldHtmlType>1</fieldHtmlType>
            //                     <fieldId>8162</fieldId>
            //                     <fieldName>cdesl</fieldName>
            //                     <fieldOrder>0</fieldOrder>
            //                     <fieldShowName>超定额数量</fieldShowName>
            //                     <fieldShowValue>1212</fieldShowValue>
            //                     <fieldType>3</fieldType>
            //                     <fieldValue>1212</fieldValue>
            //                     <filedHtmlShow>1212</filedHtmlShow>
            //                     <mand>false</mand>
            //                     <view>true</view>
            WorkflowRequestTableField workflowRequestTableFielcde = new WorkflowRequestTableField();
            workflowRequestTableFielcde.setEdit(true);
            workflowRequestTableFielcde.setFieldDBType("number(15,3)");
            workflowRequestTableFielcde.setFieldFormName("field8162");
            workflowRequestTableFielcde.setFieldHtmlType("1");
            workflowRequestTableFielcde.setFieldId("8162");
            workflowRequestTableFielcde.setFieldName("cdesl");
            workflowRequestTableFielcde.setFieldOrder(0);
            workflowRequestTableFielcde.setFieldShowName("超定额数量");
            workflowRequestTableFielcde.setFieldShowValue("0");
            workflowRequestTableFielcde.setFieldType("3");
            workflowRequestTableFielcde.setFieldValue("0");
            workflowRequestTableFielcde.setFiledHtmlShow("0");
            workflowRequestTableFielcde.setMand(false);
            workflowRequestTableFielcde.setView(true);
            workflowRequestTableRecords.getWorkflowRequestTableFields().add(workflowRequestTableFielcde);

            //  TODO <edit>true</edit>
            //                     <fieldDBType>number(15,2)</fieldDBType>
            //                     <fieldFormName>field8163</fieldFormName>
            //                     <fieldHtmlType>1</fieldHtmlType>
            //                     <fieldId>8163</fieldId>
            //                     <fieldName>cdeje</fieldName>
            //                     <fieldOrder>0</fieldOrder>
            //                     <fieldShowName>超定额金额</fieldShowName>
            //                     <fieldShowValue>0</fieldShowValue>
            //                     <fieldType>3</fieldType>
            //                     <fieldValue>0</fieldValue>
            //                     <filedHtmlShow>0</filedHtmlShow>
            //                     <mand>false</mand>
            //                     <view>true</view>

            WorkflowRequestTableField workflowRequestTableFielcdeje = new WorkflowRequestTableField();
            workflowRequestTableFielcdeje.setEdit(true);
            workflowRequestTableFielcdeje.setFieldDBType("number(15,2)");
            workflowRequestTableFielcdeje.setFieldFormName("field8163");
            workflowRequestTableFielcdeje.setFieldHtmlType("1");
            workflowRequestTableFielcdeje.setFieldId("8163");
            workflowRequestTableFielcdeje.setFieldName("cdeje");
            workflowRequestTableFielcdeje.setFieldOrder(0);
            workflowRequestTableFielcdeje.setFieldShowName("超定额金额");
            workflowRequestTableFielcdeje.setFieldShowValue("0");
            workflowRequestTableFielcdeje.setFieldType("3");
            workflowRequestTableFielcdeje.setFieldValue("0");
            workflowRequestTableFielcdeje.setFiledHtmlShow("0");
            workflowRequestTableFielcdeje.setMand(false);
            workflowRequestTableFielcdeje.setView(true);
            workflowRequestTableRecords.getWorkflowRequestTableFields().add(workflowRequestTableFielcdeje);

            //  TODO 备注
            //                     <edit>true</edit>
            //                     <fieldDBType>varchar2(400)</fieldDBType>
            //                     <fieldFormName>field8165</fieldFormName>
            //                     <fieldHtmlType>1</fieldHtmlType>
            //                     <fieldId>8165</fieldId>
            //                     <fieldName>bz</fieldName>
            //                     <fieldOrder>0</fieldOrder>
            //                     <fieldShowName>备注</fieldShowName>
            //                     <fieldShowValue>12</fieldShowValue>
            //                     <fieldType>1</fieldType>
            //                     <fieldValue>12</fieldValue>
            //                     <filedHtmlShow>12</filedHtmlShow>
            //                     <mand>false</mand>
            //                     <view>true</view>

            WorkflowRequestTableField workflowRequestTableFieltc_sqds15 = new WorkflowRequestTableField();
            workflowRequestTableFieltc_sqds15.setEdit(true);
            workflowRequestTableFieltc_sqds15.setFieldDBType("varchar2(400)");
            workflowRequestTableFieltc_sqds15.setFieldFormName("field8165");
            workflowRequestTableFieltc_sqds15.setFieldHtmlType("1");
            workflowRequestTableFieltc_sqds15.setFieldId("8165");
            workflowRequestTableFieltc_sqds15.setFieldName("bz");
            workflowRequestTableFieltc_sqds15.setFieldOrder(0);
            workflowRequestTableFieltc_sqds15.setFieldShowName("备注");
            String TC_SQDS15 = sqdsList.get(i).get("TC_SQDS15")!=null ?sqdsList.get(i).get("TC_SQDS15").toString():"无";
            workflowRequestTableFieltc_sqds15.setFieldShowValue(TC_SQDS15);
            workflowRequestTableFieltc_sqds15.setFieldType("3");
            workflowRequestTableFieltc_sqds15.setFieldValue(TC_SQDS15);
            workflowRequestTableFieltc_sqds15.setFiledHtmlShow(TC_SQDS15);
            workflowRequestTableFieltc_sqds15.setMand(false);
            workflowRequestTableFieltc_sqds15.setView(true);
            workflowRequestTableRecords.getWorkflowRequestTableFields().add(workflowRequestTableFieltc_sqds15);


            /**
             * 需求日期
             */
            String TC_SQDSNEEDDATE = sqdsList.get(i).get("TC_SQDSNEEDDATE")!=null ?sqdsList.get(i).get("TC_SQDSNEEDDATE").toString():"1045";
            if (!"1045".equals(TC_SQDSNEEDDATE)) {
                WorkflowRequestTableField workflowRequestTableFielTC_SQDSNEEDDATE = new WorkflowRequestTableField();
                workflowRequestTableFieltc_sqds15.setEdit(true);
                workflowRequestTableFieltc_sqds15.setFieldDBType("char(20)");
                workflowRequestTableFieltc_sqds15.setFieldFormName("field74461");
                workflowRequestTableFieltc_sqds15.setFieldHtmlType("1");
                workflowRequestTableFieltc_sqds15.setFieldId("74461");
                workflowRequestTableFieltc_sqds15.setFieldName("xqrq");
                workflowRequestTableFieltc_sqds15.setFieldOrder(0);
                workflowRequestTableFieltc_sqds15.setFieldShowName("需求日期");

                workflowRequestTableFieltc_sqds15.setFieldShowValue(TC_SQDSNEEDDATE);
                workflowRequestTableFieltc_sqds15.setFieldType("3");
                workflowRequestTableFieltc_sqds15.setFieldValue(TC_SQDSNEEDDATE);
                workflowRequestTableFieltc_sqds15.setFiledHtmlShow(TC_SQDSNEEDDATE);
                workflowRequestTableFieltc_sqds15.setMand(false);
                workflowRequestTableFieltc_sqds15.setView(true);
                workflowRequestTableRecords.getWorkflowRequestTableFields().add(workflowRequestTableFielTC_SQDSNEEDDATE);
            }

            //    TODO ERP料号tc_sqds09
            //                     <edit>true</edit>
            //                     <fieldDBType>varchar2(400)</fieldDBType>
            //                     <fieldFormName>field8164</fieldFormName>
            //                     <fieldHtmlType>1</fieldHtmlType>
            //                     <fieldId>8164</fieldId>
            //                     <fieldName>ERPlh</fieldName>
            //                     <fieldOrder>0</fieldOrder>
            //                     <fieldShowName>ERP料号</fieldShowName>
            //                     <fieldShowValue>MISC</fieldShowValue>
            //                     <fieldType>1</fieldType>
            //                     <fieldValue>MISC</fieldValue>
            //                     <filedHtmlShow>MISC</filedHtmlShow>
            //                     <mand>false</mand>
            //                     <view>true</view>

            WorkflowRequestTableField workflowRequestTableFieltc_sqds09 = new WorkflowRequestTableField();
            workflowRequestTableFieltc_sqds09.setEdit(true);
            workflowRequestTableFieltc_sqds09.setFieldDBType("varchar2(400)");
            workflowRequestTableFieltc_sqds09.setFieldFormName("field8164");
            workflowRequestTableFieltc_sqds09.setFieldHtmlType("1");
            workflowRequestTableFieltc_sqds09.setFieldId("8164");
            workflowRequestTableFieltc_sqds09.setFieldName("ERPlh");
            workflowRequestTableFieltc_sqds09.setFieldOrder(0);
            workflowRequestTableFieltc_sqds09.setFieldShowName("ERP料号");
            String TC_SQDS09 = sqdsList.get(i).get("TC_SQDS09")!=null?sqdsList.get(i).get("TC_SQDS09").toString():"无";
            workflowRequestTableFieltc_sqds09.setFieldShowValue(TC_SQDS09);
            workflowRequestTableFieltc_sqds09.setFieldType("3");
            workflowRequestTableFieltc_sqds09.setFieldValue(TC_SQDS09);
            workflowRequestTableFieltc_sqds09.setFiledHtmlShow(TC_SQDS09);
            workflowRequestTableFieltc_sqds09.setMand(false);
            workflowRequestTableFieltc_sqds09.setView(true);
            workflowRequestTableRecords.getWorkflowRequestTableFields().add(workflowRequestTableFieltc_sqds09);

            //    TODO ERP部门编码tc_sqds10
            //                     <edit>true</edit>
            //                     <fieldDBType>browser.bmmc</fieldDBType>
            //                     <fieldFormName>field8521</fieldFormName>
            //                     <fieldHtmlType>3</fieldHtmlType>
            //                     <fieldId>8521</fieldId>
            //                     <fieldName>erpbmbm</fieldName>
            //                     <fieldOrder>0</fieldOrder>
            //                     <fieldShowName>ERP部门编码</fieldShowName>
            //                     <fieldShowValue>&lt;a title=''>&lt;/a>&amp;nbsp</fieldShowValue>
            //                     <fieldType>161</fieldType>
            //                     <fieldValue>ZPS07</fieldValue>
            //                     <filedHtmlShow>&lt;div style="width:100%;">&lt;a title=''>&lt;/a>&amp;nbsp&lt;/div></filedHtmlShow>
            //                     <mand>false</mand>
            //                     <view>true</view>

          /* WorkflowRequestTableField workflowRequestTableFieltc_sqds10 = new WorkflowRequestTableField();
           workflowRequestTableFieltc_sqds10.setEdit(true);
           workflowRequestTableFieltc_sqds10.setFieldDBType("browser.bmmc");
           workflowRequestTableFieltc_sqds10.setFieldFormName("field8521");
           workflowRequestTableFieltc_sqds10.setFieldHtmlType("1");
           workflowRequestTableFieltc_sqds10.setFieldId("8521");
           workflowRequestTableFieltc_sqds10.setFieldName("erpbmbm");
           workflowRequestTableFieltc_sqds10.setFieldOrder(0);
           workflowRequestTableFieltc_sqds10.setFieldShowName("ERP部门编码");
           String TC_SQDS10 = sqdsList.get(i).get("TC_SQDS10")!=null ?sqdsList.get(i).get("TC_SQDS10").toString():"无";
           workflowRequestTableFieltc_sqds10.setFieldShowValue(TC_SQDS10);
           workflowRequestTableFieltc_sqds10.setFieldType("3");
           workflowRequestTableFieltc_sqds10.setFieldValue(TC_SQDS10);
           workflowRequestTableFieltc_sqds10.setFiledHtmlShow(TC_SQDS10);
           workflowRequestTableFieltc_sqds10.setMand(false);
           workflowRequestTableFieltc_sqds10.setView(true);
           workflowRequestTableRecords.getWorkflowRequestTableFields().add(workflowRequestTableFieltc_sqds10);*/


            //  TODO  起订数量 tc_sqds08
            //                <edit>true</edit>
            //                     <fieldDBType>number(15,2)</fieldDBType>
            //                     <fieldFormName>field12160</fieldFormName>
            //                     <fieldHtmlType>1</fieldHtmlType>
            //                     <fieldId>12160</fieldId>
            //                     <fieldName>sl1</fieldName>
            //                     <fieldOrder>0</fieldOrder>
            //                     <fieldShowName>起订数量</fieldShowName>
            //                     <fieldType>3</fieldType>
            //                     <mand>false</mand>
            //                     <view>true</view>

            WorkflowRequestTableField workflowRequestTableFieltc_sqds08 = new WorkflowRequestTableField();
            workflowRequestTableFieltc_sqds08.setEdit(true);
            workflowRequestTableFieltc_sqds08.setFieldDBType("number(15,2)");
            workflowRequestTableFieltc_sqds08.setFieldFormName("field12160");
            workflowRequestTableFieltc_sqds08.setFieldHtmlType("1");
            workflowRequestTableFieltc_sqds08.setFieldId("12160");
            workflowRequestTableFieltc_sqds08.setFieldName("sl1");
            workflowRequestTableFieltc_sqds08.setFieldOrder(0);
            workflowRequestTableFieltc_sqds08.setFieldShowName("起订数量");
            String TC_SQDS08 = sqdsList.get(i).get("TC_SQDS08")!=null?sqdsList.get(i).get("TC_SQDS08").toString():"0.00";
            workflowRequestTableFieltc_sqds08.setFieldShowValue(TC_SQDS08);
            workflowRequestTableFieltc_sqds08.setFieldType("3");
            workflowRequestTableFieltc_sqds08.setFieldValue(TC_SQDS08);
            workflowRequestTableFieltc_sqds08.setFiledHtmlShow(TC_SQDS08);
            workflowRequestTableFieltc_sqds08.setMand(false);
            workflowRequestTableFieltc_sqds08.setView(true);
            workflowRequestTableRecords.getWorkflowRequestTableFields().add(workflowRequestTableFieltc_sqds08);

            //   TODO 相减数
            //                     <edit>true</edit>
            //                     <fieldDBType>number(15,2)</fieldDBType>
            //                     <fieldFormName>field12161</fieldFormName>
            //                     <fieldHtmlType>1</fieldHtmlType>
            //                     <fieldId>12161</fieldId>
            //                     <fieldName>xjs</fieldName>
            //                     <fieldOrder>0</fieldOrder>
            //                     <fieldShowName>相减数</fieldShowName>
            //                     <fieldShowValue>1212</fieldShowValue>
            //                     <fieldType>3</fieldType>
            //                     <fieldValue>1212</fieldValue>
            //                     <filedHtmlShow>1212</filedHtmlShow>
            //                     <mand>false</mand>
            //                     <view>true</view>

            WorkflowRequestTableField workflowRequestTableFieltc_sqdsxjs = new WorkflowRequestTableField();
            workflowRequestTableFieltc_sqdsxjs.setEdit(true);
            workflowRequestTableFieltc_sqdsxjs.setFieldDBType("number(15,2)");
            workflowRequestTableFieltc_sqdsxjs.setFieldFormName("field12161");
            workflowRequestTableFieltc_sqdsxjs.setFieldHtmlType("1");
            workflowRequestTableFieltc_sqdsxjs.setFieldId("12161");
            workflowRequestTableFieltc_sqdsxjs.setFieldName("xjs");
            workflowRequestTableFieltc_sqdsxjs.setFieldOrder(0);
            workflowRequestTableFieltc_sqdsxjs.setFieldShowName("相减数");
            workflowRequestTableFieltc_sqdsxjs.setFieldShowValue("0");
            workflowRequestTableFieltc_sqdsxjs.setFieldType("3");
            workflowRequestTableFieltc_sqdsxjs.setFieldValue("0");
            workflowRequestTableFieltc_sqdsxjs.setFiledHtmlShow("0");
            workflowRequestTableFieltc_sqdsxjs.setMand(false);
            workflowRequestTableFieltc_sqdsxjs.setView(true);
            workflowRequestTableRecords.getWorkflowRequestTableFields().add(workflowRequestTableFieltc_sqdsxjs);
            workflowDetailTableInfos.getWorkflowRequestTableRecords().add(workflowRequestTableRecords);

        }

        workflowRequestInfo.setWorkflowMainTableInfo(workflowMainTableInfo);

        workflowRequestInfo.getWorkflowDetailTableInfos().add(workflowDetailTableInfos);

        workflowRequestInfo.setWorkflowBaseInfo(workflowBaseInfo);
        logger.debug(JSON.toJSONString(workflowRequestInfo));
        logger.debug("发起流程getUserId="+info.getUserId());
        String doCreateWorkflowRequest;
        try {
            doCreateWorkflowRequest = erpwsImplService.getERPWSImplPort().doCreateWorkflowRequest(workflowRequestInfo, Integer.valueOf(info.getUserId()));

        } catch (Exception e) {
            e.printStackTrace();
            return "-9";
        }

        logger.debug("发起流程doCreateWorkflowRequest=" + doCreateWorkflowRequest + erpwsImplService.toString());
        String tc_sqds18 = null;
        String tc_sqds16 = null;

        if (!NumberUtils.isDigits(doCreateWorkflowRequest)) {
            // doCreateWorkflowRequest = "1";//流程状态1流程准备中，2创建成功，3，创建失败，4撤单中，5撤单成功
            tc_sqds18 = "未知的错误";
            tc_sqds16 = "1";
            doCreateWorkflowRequest = "-9";
        } else {
            switch (doCreateWorkflowRequest) {
                case "-1":
                    tc_sqds18 = "流程创建失败";
                    tc_sqds16 = "3";
                    break;
                case "-2":
                    tc_sqds18 = "没有创建权限";
                    tc_sqds16 = "3";
                    break;
                case "-3":
                    tc_sqds18 = "创建流程失败";
                    tc_sqds16 = "3";
                    break;
                case "-4":
                    tc_sqds18 = "字段或者表名不正确";
                    tc_sqds16 = "3";
                    break;
                case "-5":
                    tc_sqds18 = "更新流程级别失败";
                    tc_sqds16 = "3";
                    break;
                case "-6":
                    tc_sqds18 = "无法创建流程代办任务";
                    tc_sqds16 = "3";
                    break;
                case "-7":
                    tc_sqds18 = "流程下一节点出错，检查流程配置";
                    tc_sqds16 = "3";
                    break;
                case "-8":
                    tc_sqds18 = "流程下一节点出错，检查流程配置";
                    tc_sqds16 = "3";
                    break;
                default:
                    tc_sqds16 = "2";
                    tc_sqds18 = "流程创建成功";
                    break;
            }
        }
        if ("DS1".equals(ds)) {
            this.imaFileMapper.insertByOA(sqId, ds, workshop, purchase, doCreateWorkflowRequest, tc_sqds18, tc_sqds16);
        }

        return doCreateWorkflowRequest;
    }


    /**
     * 科力普批量校验接口
     * @param sqId
     * @param ds
     * @return
     */
    @Override
    public String colipuCheck(Integer sqId, String ds) {

        List<Map<String, Object>> colipuParams = imaFileMapper.querySqDsByIdColipu(sqId,ds);
        if (CollectionUtils.isEmpty(colipuParams)){
            return "科力普接口没有处理任何数据！";
        }
        ArrayList skustemp = new ArrayList();
        for(int i=0;i<colipuParams.size();i++){
            skustemp.add(colipuParams.get(i).get("TC_SQDS20"));
        }

        Map<String, String> map = new HashMap<String, String>();
        map.put("skus", skustemp.toString().replace("[","").replace("]",""));
        map.put("appKey", "ChenGuang");
        map.put("appSecret", "3b149f2dbab4ef5b88e7cd89f7f6cf4a");
        String colipuoRespose = HttpClientUtil.doGet("http://api.ucip.colipu.com/chenguang/api/restful/products/status", map);
        // 生成 JSON 对象
        List<ColipuoRelult> colipuoRelults = new ArrayList();
        JSONObject obj = JSONObject.parseObject(colipuoRespose);
        if (Boolean.valueOf(obj.get("success").toString())){
            JSONArray array = JSONArray.parseArray(obj.get("result").toString());

            for(int i=0;i<array.size();i++){
                ColipuoRelult colipuoRelult = JSONObject.parseObject(array.get(i).toString(),ColipuoRelult.class);
                colipuoRelults.add(colipuoRelult);

            }

        }

        if(CollectionUtils.isEmpty(colipuoRelults)){
            return "科力普接口反馈没有任何反馈！";
        }
        StringBuffer sb = new StringBuffer("科力普反馈已下架或者不存在：");
        for(ColipuoRelult colipuoRelult:colipuoRelults){
            if (1==colipuoRelult.getExist()&&1==colipuoRelult.getState()){

            }else {
                sb.append(colipuoRelult.getSku()+",");
            }
        }

        logger.debug("get请求调用成功，返回数据是：" + colipuoRespose);

        return sb.toString();
    }

    @Value("${colipu.appKey}")
    private String appKey;
    @Value("${colipu.appSecret}")
    private String appSecret;
    @Value("${colipu.colipuurl}")
    private String colipuurl;



    /**
     * 科力普单个校验接口
     * @param itemNo
     * @return
     */
    @Override
    public String colipuCheckSingle(String itemNo) {
        Map<String, String> map = new HashMap<String, String>();
        map.put("skus", itemNo);
        map.put("appKey", appKey);
        map.put("appSecret", appSecret);
//        String colipuoRespose = HttpClientUtil.doGet("http://api.ucip.colipu.com/chenguang/api/restful/products/status", map);
        String colipuoRespose = HttpClientUtil.doGet(colipuurl, map);
        // 生成 JSON 对象
        List<ColipuoRelult> colipuoRelults = new ArrayList();

            JSONObject obj = JSONObject.parseObject(colipuoRespose);
            if (Boolean.valueOf(obj.get("success").toString())){
                JSONArray array = JSONArray.parseArray(obj.get("result").toString());
                for(int i=0;i<array.size();i++){
                    ColipuoRelult colipuoRelult = JSONObject.parseObject(array.get(i).toString(),ColipuoRelult.class);
                    colipuoRelults.add(colipuoRelult);
                }

            }


        StringBuffer sb = new StringBuffer("科力普反馈:");
        if (CollectionUtils.isEmpty(colipuoRelults)){
            return "科力普接口没有任何反馈，请稍后重试！";
        }else {

            if (0== colipuoRelults.get(0).getExist()){
                sb.append("sku:"+itemNo+"不存在,请找相应采购确认当前料号品名是否维护正确！");
                return sb.toString();
            } else {
                if (0==colipuoRelults.get(0).getState()){
                    sb.append("sku:"+itemNo+"已下架,请找相应采购确认其他替代料号！");
                    return sb.toString();
                }
            }

        }

        logger.debug("get请求调用成功，返回数据是：" + colipuoRespose);

        return "success";
    }

    @Override
    public String sendMail(String id) {

        //先查询错误数据
        int count =0;
        List<Map<String,Object>> uflogs = this.imaFileMapper.selectuflogByToday();
        if (StringUtil.isNotEmpty(uflogs)){
            for (Map uflog : uflogs
            ) {
                String lcmc = uflog.get("LCID").toString().split("-")[1];

                StringUtil emaillcmc = this.imaFileMapper.selectEmailBylcmc(lcmc);
                this.sendMailutil(emaillcmc.toString(), "请购单未生成提醒:" + uflog.get("LCMC"),
                        uflog.get("LCMC") + "于" + uflog.get("BDATE") + ",请购单生成错误，错误信息为：" + uflog.get("ERRMSG1") + "，流程号为：" + uflog.get("LCID"));
                count++;
            }
        }


        List<Map<String,Object>> flcgLogs = this.imaFileMapper.selectByToday();
        if (StringUtil.isNotEmpty(flcgLogs)){
            for (Map map :flcgLogs){
                List<String> gens = this.imaFileMapper.selectcountcpmla(map.get("REQUESTID").toString(),map.get("SSGS").toString());
                if (StringUtil.isNotEmpty(gens)){

                    String count2 = this.imaFileMapper.selectByrequestid(map.get("REQUESTID").toString());
                    if (StringUtil.isNotEmpty(count2)) {
                        int hh = count2.split("--").length;
                        int jj= this.imaFileMapper.countcpmla(map.get("REQUESTID").toString(),map.get("SSGS").toString());

                        if (jj!= hh) {
                            Map userInfo  = this.imaFileMapper.selectiUserInfo(map.get("REQUESTID").toString());
                            if (StringUtil.isNotEmpty(userInfo)){


                                this.sendMailutil(userInfo.get("GEN02").toString(), "请购单未生成提醒:"
                                                +userInfo.get("TC_SQDT02"),
                                        "《《"+userInfo.get("TC_SQDT02")+
                                                "》》，生成的请购单可能有一些请购单号未生成，你可以通过以下信息进一步确认数据准确性并在erp中点击同步流程按钮" +
                                                "得到进一步信息" +
                                                "：该流程号生成可能有误，erp查询单号:"
                                                +userInfo.get("TC_SQDT01")+",oa流程号为："+map.get("REQUESTID"));
                                count++;
                                for (String gen :gens ){
                                    if (StringUtil.isNotEmpty(gen)) {
                                        this.sendMailutil(gen, "请购单未生成提醒:" + userInfo.get("TC_SQDT02"),
                                            "《《"+userInfo.get("TC_SQDT02")+
                                                    "》》，生成的请购单可能有一些请购单号未生成，你可以通过以下信息进一步确认数据准确性并在erp中点击同步流程按钮" +
                                                    "得到进一步信息" +
                                                    "：该流程号生成可能有误，erp查询单号:"
                                                    + userInfo.get("TC_SQDT01") + ",oa流程号为：" + map.get("REQUESTID"));
                                    }
                                }
                            }


                        }

                    }}
            }
        }


        return count+"笔";
    }

    @Override
    public List<ErpAccessoriesData> selectErpAccessoriesData() {
        return this.imaFileMapper.selectErpAccessoriesData();
    }

    @Override
    public String sendMailAttachment(String hrno) {

        String name = this.imaFileMapper.selectNameByHrno(hrno);
        if (StringUtil.isEmpty(name)) {
            return "无该用户";
        }
        List<ErpAccessoriesData> list = selectErpAccessoriesData();
        ExcelUtil<ErpAccessoriesData> util = new ExcelUtil<ErpAccessoriesData>(ErpAccessoriesData.class);
        AjaxResult result = util.exportExcel(list, "生产辅料");
        if (!"0".equals(result.get("code").toString())) {
            return "失败";
        }
        String fileName = result.get("msg").toString();
        if (StringUtil.isEmpty(fileName)) {
            return "未生成文件，请稍后重试";
        }

        this.sendMailAttachment(name, "最新辅料附件", "最新辅料附件", fileName);

        List<String> nameqg = this.imaFileMapper.selectsqdsName();
        for (String nametemp :nameqg){
            if (StringUtil.isNotEmpty(nametemp)) {
                if (StringUtil.isNotEmpty(nametemp)) {
                    this.sendMailAttachment(nametemp, "最新辅料附件", "最新辅料附件", fileName);
                }
            }
        }
        List<String> namecg = this.imaFileMapper.selectcgName();
        for (String nametemp :namecg){
            if (StringUtil.isNotEmpty(nametemp)) {
                this.sendMailAttachment(nametemp, "最新辅料附件", "最新辅料附件", fileName);
            }
        }
        return fileName;
    }

    @Override
    @Transactional
    public String CreatFlow(Integer sqId, String ds, String workshop, String purchase,String v_gmisc) {

        HashMap<String,Object> dept =  imaFileMapper.selectDeptByCode(purchase);

        String OADEPTID = (dept!=null)&&(dept.get("TC_OADEPTID")!=null)? dept.get("TC_OADEPTID").toString(): "";
        if ("".equals(OADEPTID)){
            return "-11";
        }

        HashMap<String,Object> sqdt = imaFileMapper.querySqDtById(sqId,ds);
        if(sqdt==null){
            return "-12";
        }
        //workflowRequestInfo
        WorkflowRequestInfo workflowRequestInfo = new WorkflowRequestInfo();
        String TC_SQDT02 = sqdt.get("TC_SQDT02")!=null? sqdt.get("TC_SQDT02").toString(): "";

        String TC_SQDT04 = sqdt.get("TC_SQDT04")!=null? sqdt.get("TC_SQDT04").toString(): "无";
        String TC_SQDT05 = sqdt.get("TC_SQDT05")!=null? sqdt.get("TC_SQDT05").toString(): "无";
        String TC_SQDT06 = sqdt.get("TC_SQDT06")!=null? sqdt.get("TC_SQDT06").toString(): "无";
        String TC_SQDT03 = sqdt.get("TC_SQDT03")!=null? sqdt.get("TC_SQDT03").toString(): "0";

        TC_SQDT02 = TC_SQDT02 +"-"+ workshop + "-"+purchase;
        workflowRequestInfo.setRequestName(TC_SQDT02);//TODO
        //
        workflowRequestInfo.setCanEdit(false);
        workflowRequestInfo.setCanView(true);
        String TC_SQDT07 =sqdt.get("TC_SQDT07")!=null? sqdt.get("TC_SQDT07").toString(): "2999-12-31";

        workflowRequestInfo.setCreateTime(TC_SQDT07);
        String GEN02 = sqdt.get("GEN02")!=null? sqdt.get("GEN02").toString(): "无";
        workflowRequestInfo.setCreatorName(GEN02);
        //workflowBaseInfo
        WorkflowBaseInfo workflowBaseInfo = new WorkflowBaseInfo();
        workflowBaseInfo.setWorkflowId("26183");//23688  20200107 26183
        workflowBaseInfo.setWorkflowName("生产辅料申购单");

        //
        ERPWSImplService erpwsImplService = new ERPWSImplService();
        if (sqdt.get("TC_SQDTMODU") == null ){
            return  "-13";
        }
        String TC_SQDTMODUtemp = sqdt.get("TC_SQDTMODU")!=null? sqdt.get("TC_SQDTMODU").toString(): "0";
        String TC_SQDTMODU;
        if(NumberUtils.isDigits(TC_SQDTMODUtemp)){
            DecimalFormat g1=new DecimalFormat("000000");
            TC_SQDTMODU = g1.format(Integer.valueOf(TC_SQDTMODUtemp));}
        else {
            TC_SQDTMODU = TC_SQDTMODUtemp;
        }
        UserInfo info = erpwsImplService.getERPWSImplPort().findUserInfoByHRNo(TC_SQDTMODU);
        if (!info.isSuccess()){
            return  "-14";
        }
        workflowRequestInfo.setCreatorId(info.getUserId());

        //workflowMainTableInfo
        WorkflowMainTableInfo workflowMainTableInfo = new WorkflowMainTableInfo();
        workflowMainTableInfo.setTableDBName("formtable_main_100");
        WorkflowRequestTableRecord workflowRequestTableRecord = new WorkflowRequestTableRecord();

        workflowRequestTableRecord.setRecordOrder(0);
        WorkflowRequestTableField workflowRequestTableFieldbiaoti = new WorkflowRequestTableField();
        workflowRequestTableFieldbiaoti.setEdit(true);
        workflowRequestTableFieldbiaoti.setFieldFormName("requestname");
        workflowRequestTableFieldbiaoti.setFieldHtmlType("1");
        workflowRequestTableFieldbiaoti.setFieldId("-1");
        workflowRequestTableFieldbiaoti.setFieldName("requestname");
        workflowRequestTableFieldbiaoti.setFieldOrder(-1);
        workflowRequestTableFieldbiaoti.setFieldShowName("标题");
        workflowRequestTableFieldbiaoti.setFieldShowValue(TC_SQDT02);//TODO
        workflowRequestTableFieldbiaoti.setFieldValue(TC_SQDT02);//TODO
        workflowRequestTableFieldbiaoti.setFieldHtmlType(TC_SQDT02);//TODO
        workflowRequestTableFieldbiaoti.setMand(true);
        workflowRequestTableFieldbiaoti.setView(true);
        workflowRequestTableRecord.getWorkflowRequestTableFields().add(workflowRequestTableFieldbiaoti);
        //REQUESTLEVEL
        //MESSAGETYPE
        //MISC物料查看国内
        //MISC物料查看行政
        //上月
        //TODO 所属分厂
        WorkflowRequestTableField workflowRequestTableFieldshfc = new WorkflowRequestTableField();
        // imaFileMapper.queryshfc();
        workflowRequestTableFieldshfc.setEdit(true);
        workflowRequestTableFieldshfc.setFieldDBType("integer");
        workflowRequestTableFieldshfc.setFieldFormName("field8444");
        workflowRequestTableFieldshfc.setFieldHtmlType("3");
        workflowRequestTableFieldshfc.setFieldId("8444");
        workflowRequestTableFieldshfc.setFieldName("shfc");
        workflowRequestTableFieldshfc.setFieldOrder(3);
        workflowRequestTableFieldshfc.setFieldShowName("所属分厂");

        HashMap<String,Object> oaud =  imaFileMapper.selectOaDeptByCode(TC_SQDTMODU);
        // HashMap<String,Object> dept2 =  imaFileMapper.selectDeptByCode(TC_SQDT05);
        String SHFC =(oaud!=null)&&(oaud.get("SHFC")!=null)? oaud.get("SHFC").toString(): "无";
        String SQBM =(oaud!=null)&&(oaud.get("SQBM")!=null)? oaud.get("SQBM").toString(): "无";
        String ZJSJGH = (oaud!=null)&&(oaud.get("ZJSJGH")!=null)? oaud.get("ZJSJGH").toString(): "无";
        String FENJIHAO = (oaud != null) && (oaud.get("TELEPHONE") != null) ? oaud.get("TELEPHONE").toString() : "当前部门没有维护";
        logger.debug(TC_SQDTMODU);
        logger.debug(ZJSJGH);
        logger.debug(SHFC);
        logger.debug(SQBM);
        if ("无".equals(SHFC)){
            return "-11";
        }
        if ("无".equals(SQBM)){
            return "-11";
        }
        if ("无".equals(ZJSJGH)){
            return "-11";
        }

        WorkflowRequestTableField workflowRequestTableZjsjgh = new WorkflowRequestTableField();
        workflowRequestTableZjsjgh.setEdit(true);
        workflowRequestTableZjsjgh.setFieldDBType("varchar2(60)");
        workflowRequestTableZjsjgh.setFieldFormName("field13474");
        workflowRequestTableZjsjgh.setFieldHtmlType("1");
        workflowRequestTableZjsjgh.setFieldId("13474");
        workflowRequestTableZjsjgh.setFieldName("ZJSJGH");
        // workflowRequestTableZjsjgh.setFieldOrder(60);
        workflowRequestTableZjsjgh.setFieldShowName("上级工号");
        workflowRequestTableZjsjgh.setFieldShowValue(ZJSJGH);
        workflowRequestTableZjsjgh.setFieldType("1");
        workflowRequestTableZjsjgh.setFieldValue(ZJSJGH);
        workflowRequestTableZjsjgh.setFiledHtmlShow(ZJSJGH);
        workflowRequestTableZjsjgh.setMand(false);
        workflowRequestTableZjsjgh.setView(true);
        workflowRequestTableRecord.getWorkflowRequestTableFields().add(workflowRequestTableZjsjgh);
        UserInfo info1  =  erpwsImplService.getERPWSImplPort().findUserInfoByHRNo(ZJSJGH);
        if (!info.isSuccess()){
            return  "-14";
        }
        //TODO
        WorkflowRequestTableField workflowRequestTableZjsj = new WorkflowRequestTableField();
        workflowRequestTableZjsj.setEdit(true);
        workflowRequestTableZjsj.setFieldDBType("varchar2(60)");
        workflowRequestTableZjsj.setFieldFormName("field13473");
        workflowRequestTableZjsj.setFieldHtmlType("1");
        workflowRequestTableZjsj.setFieldId("13473");
        workflowRequestTableZjsj.setFieldName("ZJSJ");
        // workflowRequestTableZjsjgh.setFieldOrder(60);
        workflowRequestTableZjsj.setFieldShowName("上级工号");
        workflowRequestTableZjsj.setFieldShowValue(info1.getUserId());
        workflowRequestTableZjsj.setFieldType("1");
        workflowRequestTableZjsj.setFieldValue(info1.getUserId());
        workflowRequestTableZjsj.setFiledHtmlShow(info1.getUserId());
        workflowRequestTableZjsj.setMand(false);
        workflowRequestTableZjsj.setView(true);
        workflowRequestTableRecord.getWorkflowRequestTableFields().add(workflowRequestTableZjsj);
        workflowRequestTableFieldshfc.setFieldShowValue(SHFC);//TODO
        workflowRequestTableFieldshfc.setFieldType("4");
        workflowRequestTableFieldshfc.setFieldValue(SHFC);//TODO
        workflowRequestTableFieldshfc.setFieldHtmlType(SHFC);//TODO
        workflowRequestTableFieldshfc.setMand(false);
        workflowRequestTableFieldshfc.setView(true);
        workflowRequestTableRecord.getWorkflowRequestTableFields().add(workflowRequestTableFieldshfc);
        //权限值
        //单别中文
        WorkflowRequestTableField workflowRequestTableFieldbzw = new WorkflowRequestTableField();
        workflowRequestTableFieldbzw.setEdit(true);
        workflowRequestTableFieldbzw.setFieldDBType("varchar2(200)");
        workflowRequestTableFieldbzw.setFieldFormName("field8557");
        workflowRequestTableFieldbzw.setFieldHtmlType("1");
        workflowRequestTableFieldbzw.setFieldId("8557");
        workflowRequestTableFieldbzw.setFieldName("dbzw");
        workflowRequestTableFieldbzw.setFieldOrder(5);
        workflowRequestTableFieldbzw.setFieldShowName("所属分厂");
        workflowRequestTableFieldbzw.setFieldType("1");
        if("MISC".equals(v_gmisc)){
            if ("DS2".equals(ds)){
                TC_SQDT05 = "AFQ" ;
            }else {
                TC_SQDT05 = "OFQ" ;
            }

        }
        String SMYDESC = imaFileMapper.qrySmyDesc(TC_SQDT05.trim(),ds);
        String newStr = "";
        if(SMYDESC != null && SMYDESC.length() != 0)
        {
            if ("费用请购单(MISC)".equals(SMYDESC)) {
                newStr = SMYDESC.replaceAll("费用请购单", "ERP分流 费用请购单 ");
            } else {
                newStr = SMYDESC.replaceAll("人工", "ERP分流 ");
            }
        }
        logger.debug("SMYDESC"+newStr);
        workflowRequestTableFieldbzw.setFieldShowValue(newStr);//TODO
        workflowRequestTableFieldbzw.setFieldValue(newStr);//TODO
        workflowRequestTableFieldbzw.setFieldHtmlType(newStr);//TODO
        workflowRequestTableFieldbzw.setMand(false);
        workflowRequestTableFieldbzw.setView(true);
        workflowRequestTableRecord.getWorkflowRequestTableFields().add(workflowRequestTableFieldbzw);

        //本次采购金额
      /*   WorkflowRequestTableField workflowRequestTabledbje = new WorkflowRequestTableField();
        workflowRequestTabledbje.setEdit(true);
        workflowRequestTabledbje.setFieldDBType("number(15,2)");
        workflowRequestTabledbje.setFieldFormName("field8147");
        workflowRequestTabledbje.setFieldHtmlType("1");
        workflowRequestTabledbje.setFieldId("8147");
        workflowRequestTabledbje.setFieldName("je");
        workflowRequestTabledbje.setFieldOrder(33);
        workflowRequestTabledbje.setFieldShowName("本次采购金额");
        workflowRequestTabledbje.setFieldShowValue(TC_SQDT05);
        workflowRequestTabledbje.setFieldType("3");
        workflowRequestTabledbje.setFieldValue(TC_SQDT05);//TODO
        workflowRequestTabledbje.setFiledHtmlShow(TC_SQDT05);
        workflowRequestTabledbje.setMand(false);
        workflowRequestTabledbje.setView(true);
        workflowRequestTableRecord.getWorkflowRequestTableFields().add(workflowRequestTabledbje);*/
        //je
        //TODO db
        WorkflowRequestTableField workflowRequestTabledb = new WorkflowRequestTableField();
        workflowRequestTabledb.setEdit(true);
        workflowRequestTabledb.setFieldDBType("browser.djlb");
        workflowRequestTabledb.setFieldFormName("field8148");
        workflowRequestTabledb.setFieldHtmlType("3");
        workflowRequestTabledb.setFieldId("8148");
        workflowRequestTabledb.setFieldName("db");
        workflowRequestTabledb.setFieldOrder(34);
        workflowRequestTabledb.setFieldShowName(TC_SQDT05);
        workflowRequestTabledb.setFieldShowValue(TC_SQDT05);
        workflowRequestTabledb.setFieldType("161");
        workflowRequestTabledb.setFieldValue(TC_SQDT05);//TODO
        workflowRequestTabledb.setFiledHtmlShow(TC_SQDT05);
        workflowRequestTabledb.setMand(false);
        workflowRequestTabledb.setView(true);
        workflowRequestTableRecord.getWorkflowRequestTableFields().add(workflowRequestTabledb);
//ssy
        WorkflowRequestTableField workflowRequestTableFieldssy = new WorkflowRequestTableField();
        workflowRequestTableFieldssy.setEdit(true);
        workflowRequestTableFieldssy.setFieldDBType("varchar2(200)");
        workflowRequestTableFieldssy.setFieldFormName("field8582");
        workflowRequestTableFieldssy.setFieldHtmlType("1");
        workflowRequestTableFieldssy.setFieldId("8582");
        workflowRequestTableFieldssy.setFieldName("ssy");
        workflowRequestTableFieldssy.setFieldOrder(6);
        workflowRequestTableFieldssy.setFieldShowName("上上月");
        workflowRequestTableFieldssy.setFieldShowValue("201909");//TODO
        workflowRequestTableFieldssy.setFieldType("1");
        workflowRequestTableFieldssy.setFieldValue("201909");//TODO
        workflowRequestTableFieldssy.setFiledHtmlShow("201909");//TODO
        workflowRequestTableFieldssy.setMand(false);
        workflowRequestTableFieldssy.setView(true);
        workflowRequestTableRecord.getWorkflowRequestTableFields().add(workflowRequestTableFieldssy);
        //TODOyjdhrq
        WorkflowRequestTableField workflowRequestTableFielyjdhrq = new WorkflowRequestTableField();
        workflowRequestTableFielyjdhrq.setEdit(true);
        workflowRequestTableFielyjdhrq.setFieldDBType("char(10)");
        workflowRequestTableFielyjdhrq.setFieldFormName("field8598");
        workflowRequestTableFielyjdhrq.setFieldHtmlType("3");
        workflowRequestTableFielyjdhrq.setFieldId("8598");
        workflowRequestTableFielyjdhrq.setFieldName("yjdhrq");
        workflowRequestTableFielyjdhrq.setFieldOrder(7);
        workflowRequestTableFielyjdhrq.setFieldShowName("预计到货日期");
        workflowRequestTableFielyjdhrq.setFieldShowValue(TC_SQDT07);//TODO
        workflowRequestTableFielyjdhrq.setFieldType("2");
        workflowRequestTableFielyjdhrq.setFieldValue(TC_SQDT07);//TODO
        workflowRequestTableFielyjdhrq.setFiledHtmlShow(TC_SQDT07);//TODO
        workflowRequestTableFielyjdhrq.setMand(true);
        workflowRequestTableFielyjdhrq.setView(true);
        workflowRequestTableRecord.getWorkflowRequestTableFields().add(workflowRequestTableFielyjdhrq);
//cgmc1
        //bs1
        WorkflowRequestTableField workflowRequestTableFielybs1 = new WorkflowRequestTableField();
        workflowRequestTableFielybs1.setEdit(true);
        workflowRequestTableFielybs1.setFieldDBType("integer");
        workflowRequestTableFielybs1.setFieldFormName("field11276");
        workflowRequestTableFielybs1.setFieldHtmlType("5");
        workflowRequestTableFielybs1.setFieldId("11276");
        workflowRequestTableFielybs1.setFieldName("bs1");
        workflowRequestTableFielybs1.setFieldOrder(9);
        workflowRequestTableFielybs1.setFieldShowName("辅料申购流程标识");
        workflowRequestTableFielybs1.setFieldShowValue("生产辅料申购");
        workflowRequestTableFielybs1.setFieldType("1");
        workflowRequestTableFielybs1.setFieldValue("0");
        workflowRequestTableFielybs1.setFiledHtmlShow("生产辅料申购");
        workflowRequestTableFielybs1.setMand(false);
        workflowRequestTableFielybs1.setView(true);
        workflowRequestTableRecord.getWorkflowRequestTableFields().add(workflowRequestTableFielybs1);
        //cgfl
        //lsh
        WorkflowRequestTableField workflowRequestTableFielsh = new WorkflowRequestTableField();
        workflowRequestTableFielsh.setEdit(true);
        workflowRequestTableFielsh.setFieldDBType("varchar2(400)");
        workflowRequestTableFielsh.setFieldFormName("field8479");
        workflowRequestTableFielsh.setFieldHtmlType("1");
        workflowRequestTableFielsh.setFieldId("8479");
        workflowRequestTableFielsh.setFieldName("lsh");
        workflowRequestTableFielsh.setFieldOrder(11);
        workflowRequestTableFielsh.setFieldShowName("流水号");
        String lsh = UUID.randomUUID().toString();
        workflowRequestTableFielsh.setFieldShowValue(lsh);//TODO
        workflowRequestTableFielsh.setFieldType("1");
        workflowRequestTableFielsh.setFieldValue(lsh);//TODO
        workflowRequestTableFielsh.setFiledHtmlShow(lsh);//TODO
        workflowRequestTableFielsh.setMand(false);
        workflowRequestTableFielsh.setView(true);
        workflowRequestTableRecord.getWorkflowRequestTableFields().add(workflowRequestTableFielsh);

        //DQNY

        WorkflowRequestTableField workflowRequestTableFiedqny = new WorkflowRequestTableField();
        workflowRequestTableFiedqny.setEdit(true);
        workflowRequestTableFiedqny.setFieldDBType("varchar2(100)");
        workflowRequestTableFiedqny.setFieldFormName("field8478");
        workflowRequestTableFiedqny.setFieldHtmlType("1");
        workflowRequestTableFiedqny.setFieldId("8478");
        workflowRequestTableFiedqny.setFieldName("DQNY");
        workflowRequestTableFiedqny.setFieldOrder(12);
        workflowRequestTableFiedqny.setFieldShowName("当期年月");//TODO
        workflowRequestTableFiedqny.setFieldShowValue("201911");//TODO
        workflowRequestTableFiedqny.setFieldType("1");
        workflowRequestTableFiedqny.setFieldValue("201911");//TODO
        workflowRequestTableFiedqny.setFiledHtmlShow("201911");//TODO
        workflowRequestTableFiedqny.setMand(false);
        workflowRequestTableFiedqny.setView(true);
        workflowRequestTableRecord.getWorkflowRequestTableFields().add(workflowRequestTableFiedqny);
        //guidang

        WorkflowRequestTableField workflowRequestTableFieguidang = new WorkflowRequestTableField();
        workflowRequestTableFieguidang.setEdit(true);
        workflowRequestTableFieguidang.setFieldDBType("integer");
        workflowRequestTableFieguidang.setFieldFormName("field8480");
        workflowRequestTableFieguidang.setFieldHtmlType("1");
        workflowRequestTableFieguidang.setFieldId("8480");
        workflowRequestTableFieguidang.setFieldName("guidang");
        workflowRequestTableFieguidang.setFieldOrder(13);
        workflowRequestTableFieguidang.setFieldShowName("归档状态");//TODO

        workflowRequestTableFieguidang.setFieldType("1");
        workflowRequestTableFieguidang.setMand(false);
        workflowRequestTableFieguidang.setView(true);
        workflowRequestTableRecord.getWorkflowRequestTableFields().add(workflowRequestTableFieguidang);

//qgdbh
        //sqr

        WorkflowRequestTableField workflowRequestTableFiesqr = new WorkflowRequestTableField();
        workflowRequestTableFiesqr.setEdit(true);
        workflowRequestTableFiesqr.setFieldDBType("integer");
        workflowRequestTableFiesqr.setFieldFormName("field8138");
        workflowRequestTableFiesqr.setFieldHtmlType("3");
        workflowRequestTableFiesqr.setFieldId("8138");
        workflowRequestTableFiesqr.setFieldName("sqr");
        workflowRequestTableFiesqr.setFieldOrder(16);
        workflowRequestTableFiesqr.setFieldShowName("申请人");
        workflowRequestTableFiesqr.setFieldShowValue(GEN02);
        workflowRequestTableFiesqr.setFieldType("1");
        workflowRequestTableFiesqr.setFieldValue(info.getUserId());
        workflowRequestTableFiesqr.setFiledHtmlShow(GEN02);
        workflowRequestTableFiesqr.setMand(false);
        workflowRequestTableFiesqr.setView(true);
        workflowRequestTableRecord.getWorkflowRequestTableFields().add(workflowRequestTableFiesqr);

//gh
        WorkflowRequestTableField workflowRequestTableFiegh = new WorkflowRequestTableField();
        workflowRequestTableFiegh.setEdit(true);
        workflowRequestTableFiegh.setFieldDBType("varchar2(400)");
        workflowRequestTableFiegh.setFieldFormName("field8139");
        workflowRequestTableFiegh.setFieldHtmlType("1");
        workflowRequestTableFiegh.setFieldId("8139");
        workflowRequestTableFiegh.setFieldName("gh");
        workflowRequestTableFiegh.setFieldOrder(19);
        workflowRequestTableFiegh.setFieldShowName("工号");
        workflowRequestTableFiegh.setFieldShowValue(TC_SQDTMODU);
        workflowRequestTableFiegh.setFieldType("1");
        workflowRequestTableFiegh.setFieldValue(TC_SQDTMODU);
        workflowRequestTableFiegh.setFiledHtmlShow(TC_SQDTMODU);
        workflowRequestTableFiegh.setMand(false);
        workflowRequestTableFiegh.setView(true);
        workflowRequestTableRecord.getWorkflowRequestTableFields().add(workflowRequestTableFiegh);
        //sqrq
        WorkflowRequestTableField workflowRequestTablesqrq = new WorkflowRequestTableField();
        workflowRequestTablesqrq.setEdit(true);
        workflowRequestTablesqrq.setFieldDBType("char(20)");
        workflowRequestTablesqrq.setFieldFormName("field8140");
        workflowRequestTablesqrq.setFieldHtmlType("3");
        workflowRequestTablesqrq.setFieldId("8140");
        workflowRequestTablesqrq.setFieldName("sqrq");
        workflowRequestTablesqrq.setFieldOrder(21);
        workflowRequestTablesqrq.setFieldShowName("申请日期");

        workflowRequestTablesqrq.setFieldShowValue(TC_SQDT07);
        workflowRequestTablesqrq.setFieldType("2");
        workflowRequestTablesqrq.setFieldValue(TC_SQDT07);
        workflowRequestTablesqrq.setFiledHtmlShow(TC_SQDT07);
        workflowRequestTablesqrq.setMand(false);
        workflowRequestTablesqrq.setView(true);
        workflowRequestTableRecord.getWorkflowRequestTableFields().add(workflowRequestTablesqrq);
        //TODO sqbm
        WorkflowRequestTableField workflowRequestTablesqbm = new WorkflowRequestTableField();
        workflowRequestTablesqbm.setEdit(true);
        workflowRequestTablesqbm.setFieldDBType("integer");
        workflowRequestTablesqbm.setFieldFormName("field8141");
        workflowRequestTablesqbm.setFieldHtmlType("3");
        workflowRequestTablesqbm.setFieldId("8141");
        workflowRequestTablesqbm.setFieldName("sqbm");
        workflowRequestTablesqbm.setFieldOrder(23);
        workflowRequestTablesqbm.setFieldShowName("申请部门");
        //logger.debug(sqdt.get("TC_SQDTMODU").toString());
      /* HashMap   depttemp =  imaFileMapper.selectDeptByCode(sqdt.get("TC_SQDTMODU").toString());
        String dept1 =(depttemp!=null)&&(depttemp.get("TC_OADEPTID")!=null)? depttemp.get("TC_OADEPTID").toString(): "无";
        logger.debug(dept1);
    if ("无".equals(dept1)){
    return "-11";
        }*/
        workflowRequestTablesqbm.setFieldShowValue(SQBM);
        workflowRequestTablesqbm.setFieldType("4");
        workflowRequestTablesqbm.setFieldValue(SQBM);
        workflowRequestTablesqbm.setFiledHtmlShow(SQBM);
        workflowRequestTablesqbm.setMand(false);
        workflowRequestTablesqbm.setView(true);
        workflowRequestTableRecord.getWorkflowRequestTableFields().add(workflowRequestTablesqbm);
        //TODO fjh
        WorkflowRequestTableField workflowRequestTablefjh = new WorkflowRequestTableField();
        workflowRequestTablefjh.setEdit(true);
        workflowRequestTablefjh.setFieldDBType("varchar2(400)");
        workflowRequestTablefjh.setFieldFormName("field8142");
        workflowRequestTablefjh.setFieldHtmlType("1");
        workflowRequestTablefjh.setFieldId("8142");
        workflowRequestTablefjh.setFieldName("fjh");
        workflowRequestTablefjh.setFieldOrder(25);
        workflowRequestTablefjh.setFieldShowName("分机号");
        workflowRequestTablefjh.setFieldShowValue(FENJIHAO);
        workflowRequestTablefjh.setFieldType("1");
        workflowRequestTablefjh.setFieldValue(FENJIHAO);
        workflowRequestTablefjh.setFiledHtmlShow(FENJIHAO);
        workflowRequestTablefjh.setMand(false);
        workflowRequestTablefjh.setView(true);
        workflowRequestTableRecord.getWorkflowRequestTableFields().add(workflowRequestTablefjh);
        //TODO sqsy
        WorkflowRequestTableField workflowRequestTablesqsy = new WorkflowRequestTableField();
        workflowRequestTablesqsy.setEdit(true);
        workflowRequestTablesqsy.setFieldDBType("varchar2(4000)");
        workflowRequestTablesqsy.setFieldFormName("field8146");
        workflowRequestTablesqsy.setFieldHtmlType("2");
        workflowRequestTablesqsy.setFieldId("8146");
        workflowRequestTablesqsy.setFieldName("sqsy");
        workflowRequestTablesqsy.setFieldOrder(30);
        workflowRequestTablesqsy.setFieldShowName("申请事由");
        workflowRequestTablesqsy.setFieldShowValue(TC_SQDT06);
        workflowRequestTablesqsy.setFieldType("1");
        workflowRequestTablesqsy.setFieldValue(TC_SQDT06);
        workflowRequestTablesqsy.setFiledHtmlShow(TC_SQDT06);
        workflowRequestTablesqsy.setMand(false);
        workflowRequestTablesqsy.setView(true);
        workflowRequestTableRecord.getWorkflowRequestTableFields().add(workflowRequestTablesqsy);
        //ssgs
        WorkflowRequestTableField workflowRequestTablessgs = new WorkflowRequestTableField();
        workflowRequestTablessgs.setEdit(true);
        workflowRequestTablessgs.setFieldDBType("integer");
        workflowRequestTablessgs.setFieldFormName("field8149");
        workflowRequestTablessgs.setFieldHtmlType("5");
        workflowRequestTablessgs.setFieldId("8149");
        workflowRequestTablessgs.setFieldName("ssgs");
        workflowRequestTablessgs.setFieldOrder(36);
        workflowRequestTablessgs.setFieldShowName("所属公司");
        //TODO
        String ssgs = "";
        if ("DS2".equals(ds)){
            ssgs = "1";
        }else {
            ssgs = "0";
        }
        workflowRequestTablessgs.setFieldShowValue(ssgs);
        workflowRequestTablessgs.setFieldType(ssgs);
        workflowRequestTablessgs.setFieldValue(ssgs);
        workflowRequestTablessgs.setFiledHtmlShow(ssgs);
        workflowRequestTablessgs.setMand(true);
        workflowRequestTablessgs.setView(true);
        workflowRequestTableRecord.getWorkflowRequestTableFields().add(workflowRequestTablessgs);

//bycgje
        WorkflowRequestTableField workflowRequestTablebycgje = new WorkflowRequestTableField();
        workflowRequestTablebycgje.setEdit(true);
        workflowRequestTablebycgje.setFieldDBType("number(15,2)");
        workflowRequestTablebycgje.setFieldFormName("field8150");
        workflowRequestTablebycgje.setFieldHtmlType("1");
        workflowRequestTablebycgje.setFieldId("8150");
        workflowRequestTablebycgje.setFieldName("bycgje");
        workflowRequestTablebycgje.setFieldOrder(38);
        workflowRequestTablebycgje.setFieldShowName("本月已采购金额");//TODO

        String bycgjesum =  imaFileMapper.sumMonth(workshop,purchase,0);
        workflowRequestTablebycgje.setFieldShowValue(bycgjesum);
        workflowRequestTablebycgje.setFieldType("3");
        workflowRequestTablebycgje.setFieldValue(bycgjesum);
        workflowRequestTablebycgje.setFiledHtmlShow(bycgjesum);
        workflowRequestTablebycgje.setMand(false);
        workflowRequestTablebycgje.setView(true);
        workflowRequestTableRecord.getWorkflowRequestTableFields().add(workflowRequestTablebycgje);
        //sycgje

        WorkflowRequestTableField workflowRequestTablesycgje = new WorkflowRequestTableField();
        workflowRequestTablesycgje.setEdit(true);
        workflowRequestTablesycgje.setFieldDBType("number(15,2)");
        workflowRequestTablesycgje.setFieldFormName("field8151");
        workflowRequestTablesycgje.setFieldHtmlType("1");
        workflowRequestTablesycgje.setFieldId("8151");
        workflowRequestTablesycgje.setFieldName("sycgje");
        workflowRequestTablesycgje.setFieldOrder(39);
        workflowRequestTablesycgje.setFieldShowName("上月采购金额");//TODO
        String sycgjesum =  imaFileMapper.sumMonth(workshop,purchase,-1);
        workflowRequestTablesycgje.setFieldShowValue(sycgjesum);
        workflowRequestTablesycgje.setFieldType("3");
        workflowRequestTablesycgje.setFieldValue(sycgjesum);
        workflowRequestTablesycgje.setFiledHtmlShow(sycgjesum);
        workflowRequestTablesycgje.setMand(false);
        workflowRequestTablesycgje.setView(true);
        workflowRequestTableRecord.getWorkflowRequestTableFields().add(workflowRequestTablesycgje);
//ssycgje

        WorkflowRequestTableField workflowRequestTablessycgje = new WorkflowRequestTableField();
        workflowRequestTablessycgje.setEdit(true);
        workflowRequestTablessycgje.setFieldDBType("number(15,2)");
        workflowRequestTablessycgje.setFieldFormName("field8152");
        workflowRequestTablessycgje.setFieldHtmlType("1");
        workflowRequestTablessycgje.setFieldId("8152");
        workflowRequestTablessycgje.setFieldName("ssycgje");
        workflowRequestTablessycgje.setFieldOrder(42);
        workflowRequestTablessycgje.setFieldShowName("上上月采购金额");//TODO
        String ssycgjesum = imaFileMapper.sumMonth(workshop,purchase,-2);
        workflowRequestTablessycgje.setFieldShowValue(ssycgjesum);
        workflowRequestTablessycgje.setFieldType("3");
        workflowRequestTablessycgje.setFieldValue(ssycgjesum);
        workflowRequestTablessycgje.setFiledHtmlShow(ssycgjesum);
        workflowRequestTablessycgje.setMand(false);
        workflowRequestTablessycgje.setView(true);
        workflowRequestTableRecord.getWorkflowRequestTableFields().add(workflowRequestTablessycgje);

//cgbm
        WorkflowRequestTableField workflowRequestTablecgbm = new WorkflowRequestTableField();
        workflowRequestTablecgbm.setEdit(true);
        workflowRequestTablecgbm.setFieldDBType("brower.cgbm");
        workflowRequestTablecgbm.setFieldFormName("field8621");
        workflowRequestTablecgbm.setFieldHtmlType("3");
        workflowRequestTablecgbm.setFieldId("8621");
        workflowRequestTablecgbm.setFieldName("cgbm");
        workflowRequestTablecgbm.setFieldOrder(45);
        workflowRequestTablecgbm.setFieldShowName("采购部门");
        workflowRequestTablecgbm.setFieldShowValue("采购部门");
        workflowRequestTablecgbm.setFieldType("161");
        workflowRequestTablecgbm.setFieldValue(OADEPTID);

        workflowRequestTablecgbm.setFiledHtmlShow("采购部门");
        workflowRequestTablecgbm.setMand(true);
        workflowRequestTablecgbm.setView(true);
        workflowRequestTableRecord.getWorkflowRequestTableFields().add(workflowRequestTablecgbm);
//scerpbm
        WorkflowRequestTableField workflowRequestTablescerpbm = new WorkflowRequestTableField();
        workflowRequestTablescerpbm.setEdit(true);
        workflowRequestTablescerpbm.setFieldDBType("brower.scerpbm");
        workflowRequestTablescerpbm.setFieldFormName("field11290");
        workflowRequestTablescerpbm.setFieldHtmlType("3");
        workflowRequestTablescerpbm.setFieldId("11290");
        workflowRequestTablescerpbm.setFieldName("scerpbm");
        workflowRequestTablescerpbm.setFieldOrder(47);
        workflowRequestTablescerpbm.setFieldShowName("ERP部门编码");//TODO
        workflowRequestTablescerpbm.setFieldShowValue(workshop);
        workflowRequestTablescerpbm.setFieldType("161");
        workflowRequestTablescerpbm.setFieldValue(workshop);
        workflowRequestTablescerpbm.setFiledHtmlShow(workshop);
        workflowRequestTablescerpbm.setMand(false);
        workflowRequestTablescerpbm.setView(false);
        workflowRequestTableRecord.getWorkflowRequestTableFields().add(workflowRequestTablescerpbm);
        //zjsj
        WorkflowRequestTableField workflowRequestTablezjsj = new WorkflowRequestTableField();
        workflowRequestTablezjsj.setEdit(true);
        workflowRequestTablezjsj.setFieldDBType("integer");
        workflowRequestTablezjsj.setFieldFormName("field13473");
        workflowRequestTablezjsj.setFieldHtmlType("3");
        workflowRequestTablezjsj.setFieldId("13473");
        workflowRequestTablezjsj.setFieldName("zjsj");
        workflowRequestTablezjsj.setFieldOrder(48);
        workflowRequestTablezjsj.setFieldShowName("你的直接上级");//TODO
        workflowRequestTablezjsj.setFieldShowValue("ERP没有维护");
        workflowRequestTablezjsj.setFieldType("1");
        workflowRequestTablezjsj.setFieldType(info.getUserId());
        workflowRequestTablezjsj.setFiledHtmlShow("ERP没有维护");
        workflowRequestTablezjsj.setMand(true);
        workflowRequestTablezjsj.setView(true);
        //TODO 当前某某车间某某采购部门

      /*  int sqdscount = imaFileMapper.count(sqId, ds,  workshop,  purchase, v_gmisc);
        if (sqdscount==0){
            return  "-10";
        }*/
        logger.debug("sqId="+sqId+"ds="+ds+"workshop="+workshop+"purchase="+purchase+"v_gmisc="+v_gmisc);
        List<Map<String, Object>> sqdsList = imaFileMapper.querySqDsById(sqId,ds,  workshop,  purchase, v_gmisc);
        logger.debug(JSON.toJSONString(sqdsList));
        if (CollectionUtils.isEmpty(sqdsList)){
            return "-20";
        }

        //TODO erpbmbm
        WorkflowRequestTableField workflowRequestTableerpbmbm = new WorkflowRequestTableField();
        workflowRequestTableerpbmbm.setEdit(true);
        workflowRequestTableerpbmbm.setFieldDBType("brower.erpbm");
        workflowRequestTableerpbmbm.setFieldFormName("field8520");
        workflowRequestTableerpbmbm.setFieldHtmlType("3");
        workflowRequestTableerpbmbm.setFieldId("8520");
        workflowRequestTableerpbmbm.setFieldName("erpbmbm");
        workflowRequestTableerpbmbm.setFieldOrder(44);
        workflowRequestTableerpbmbm.setFieldShowName("ERP部门编码");
        workflowRequestTableerpbmbm.setFieldType("161");
        String tc_sqds10 = sqdsList.get(0).get("TC_SQDS10")!=null?sqdsList.get(0).get("TC_SQDS10").toString(): "无";
        String depName =  imaFileMapper.queryCheById(tc_sqds10);
        workflowRequestTableerpbmbm.setFieldShowValue(tc_sqds10);
        workflowRequestTableerpbmbm.setFieldValue(tc_sqds10);
        workflowRequestTableerpbmbm.setFiledHtmlShow(tc_sqds10);
        workflowRequestTableerpbmbm.setMand(true);
        workflowRequestTableerpbmbm.setView(true);
        workflowRequestTableRecord.getWorkflowRequestTableFields().add(workflowRequestTableerpbmbm);
        // fybm
        WorkflowRequestTableField workflowRequestTablefybm = new WorkflowRequestTableField();
        workflowRequestTablefybm.setEdit(true);
        workflowRequestTablefybm.setFieldDBType("varchar2(400)");
        workflowRequestTablefybm.setFieldFormName("field8173");
        workflowRequestTablefybm.setFieldHtmlType("1");
        workflowRequestTablefybm.setFieldId("8173");
        workflowRequestTablefybm.setFieldName("fybm");
        workflowRequestTablefybm.setFieldOrder(28);
        workflowRequestTablefybm.setFieldShowName(depName);
        workflowRequestTablefybm.setFieldShowValue(depName);
        workflowRequestTablefybm.setFieldType("1");
        workflowRequestTablefybm.setFieldValue(depName);
        workflowRequestTablefybm.setFiledHtmlShow(depName);
        workflowRequestTablefybm.setMand(false);
        workflowRequestTablefybm.setView(true);
        workflowRequestTableRecord.getWorkflowRequestTableFields().add(workflowRequestTablefybm);
        // qgdsqdb
        WorkflowRequestTableField workflowRequestTableqgdsqdb = new WorkflowRequestTableField();
        workflowRequestTableqgdsqdb.setEdit(true);
        workflowRequestTableqgdsqdb.setFieldDBType("INTEGER");
        workflowRequestTableqgdsqdb.setFieldFormName("field32090");
        workflowRequestTableqgdsqdb.setFieldHtmlType("1");
        workflowRequestTableqgdsqdb.setFieldId("32090");
        workflowRequestTableqgdsqdb.setFieldName("qgdsqdb");
        workflowRequestTableqgdsqdb.setFieldOrder(28);
        workflowRequestTableqgdsqdb.setFieldShowName(TC_SQDT03);
        workflowRequestTableqgdsqdb.setFieldShowValue(TC_SQDT03);
        workflowRequestTableqgdsqdb.setFieldType(TC_SQDT03);
        workflowRequestTableqgdsqdb.setFieldValue(TC_SQDT03);
        workflowRequestTableqgdsqdb.setFiledHtmlShow(TC_SQDT03);
        workflowRequestTableqgdsqdb.setMand(false);
        workflowRequestTableqgdsqdb.setView(true);
        workflowRequestTableRecord.getWorkflowRequestTableFields().add(workflowRequestTableqgdsqdb);
        workflowRequestTableRecord.getWorkflowRequestTableFields().add(workflowRequestTablezjsj);
        //
        workflowMainTableInfo.getRequestRecords().add(workflowRequestTableRecord);
        // doCreateWorkflowRequest.setCreateUserId(Integer.valueOf(info.getUserId()));
        // 0准备中，1流程创建，2创建成功，3，创建失败，4撤单中，5撤单成功
        //workflowDetailTableInfos
        WorkflowDetailTableInfo workflowDetailTableInfos = new WorkflowDetailTableInfo();
        for(int i=0 ; i<=sqdsList.size()-1; i++)
        {

            //workflowRequestTableRecords
            WorkflowRequestTableRecord workflowRequestTableRecords = new WorkflowRequestTableRecord();
            workflowRequestTableRecords.setRecordOrder(i);

            /**
             * 需求日期
             */
            String TC_SQDSNEEDDATE = sqdsList.get(i).get("TC_SQDSNEEDDATE")!=null ?sqdsList.get(i).get("TC_SQDSNEEDDATE").toString():"2020-04-05";
           // if (!"1045".equals(TC_SQDSNEEDDATE)) {
            WorkflowRequestTableField workflowRequestTableFielTC_SQDSNEEDDATE = new WorkflowRequestTableField();
            workflowRequestTableFielTC_SQDSNEEDDATE.setEdit(true);
            workflowRequestTableFielTC_SQDSNEEDDATE.setFieldDBType("char(20)");
            workflowRequestTableFielTC_SQDSNEEDDATE.setFieldFormName("field74461");
            workflowRequestTableFielTC_SQDSNEEDDATE.setFieldHtmlType("1");
            workflowRequestTableFielTC_SQDSNEEDDATE.setFieldId("74461");
            workflowRequestTableFielTC_SQDSNEEDDATE.setFieldName("xqrq");
            workflowRequestTableFielTC_SQDSNEEDDATE.setFieldOrder(0);
            workflowRequestTableFielTC_SQDSNEEDDATE.setFieldShowName("需求日期");

            workflowRequestTableFielTC_SQDSNEEDDATE.setFieldShowValue(TC_SQDSNEEDDATE);
            workflowRequestTableFielTC_SQDSNEEDDATE.setFieldType("3");
            workflowRequestTableFielTC_SQDSNEEDDATE.setFieldValue(TC_SQDSNEEDDATE);
            workflowRequestTableFielTC_SQDSNEEDDATE.setFiledHtmlShow(TC_SQDSNEEDDATE);
            workflowRequestTableFielTC_SQDSNEEDDATE.setMand(false);
            workflowRequestTableFielTC_SQDSNEEDDATE.setView(true);
                workflowRequestTableRecords.getWorkflowRequestTableFields().add(workflowRequestTableFielTC_SQDSNEEDDATE);
           // }




            //workflowRequestTableField
            //TODO 料件编号
            //   <edit>true</edit>
            //                     <fieldDBType>browser.wlxx</fieldDBType>
            //                     <fieldFormName>field8295</fieldFormName>
            //                     <fieldHtmlType>3</fieldHtmlType>
            //                     <fieldId>8295</fieldId>
            //                     <fieldName>ljbm</fieldName>
            //                     <fieldOrder>0</fieldOrder>
            //                     <fieldShowName>料件编码</fieldShowName>
            //                     <fieldShowValue>&lt;a title='OAXZ000620'>OAXZ000620&lt;/a>&amp;nbsp</fieldShowValue>
            //                     <fieldType>161</fieldType>
            //                     <fieldValue>OAXZ000620</fieldValue>
            //                     <filedHtmlShow>&lt;div style="width:100%;">&lt;a title='OAXZ000620'>OAXZ000620&lt;/a>&amp;nbsp&lt;/div></filedHtmlShow>
            //                     <mand>true</mand>
            //                     <view>true</view>
            WorkflowRequestTableField workflowRequestTableFieldtc_sqds03 = new WorkflowRequestTableField();
            workflowRequestTableFieldtc_sqds03.setEdit(true);
            workflowRequestTableFieldtc_sqds03.setFieldDBType("varchar2(500)");
            //workflowRequestTableFieldtc_sqds03.setFieldFormName("field46969");
            workflowRequestTableFieldtc_sqds03.setFieldFormName("field8295");
            workflowRequestTableFieldtc_sqds03.setFieldHtmlType("3");
            //  workflowRequestTableFieldtc_sqds03.setFieldId("46969");
            workflowRequestTableFieldtc_sqds03.setFieldId("8295");
            //  workflowRequestTableFieldtc_sqds03.setFieldName("ljbmwb");
            workflowRequestTableFieldtc_sqds03.setFieldName("xljbm");//20200107
            workflowRequestTableFieldtc_sqds03.setFieldOrder(0);
            workflowRequestTableFieldtc_sqds03.setFieldShowName("料件编码");
            String TC_SQDS03 = sqdsList.get(i).get("TC_SQDS03")!=null?sqdsList.get(i).get("TC_SQDS03").toString(): "无";

            workflowRequestTableFieldtc_sqds03.setFieldShowValue(TC_SQDS03);// TODO &lt;a title='OAXZ000620'>OAXZ000620&lt;/a>&amp;nbsp
            workflowRequestTableFieldtc_sqds03.setFieldType("161");
            workflowRequestTableFieldtc_sqds03.setFieldValue(TC_SQDS03);
            workflowRequestTableFieldtc_sqds03.setFiledHtmlShow(TC_SQDS03);//TODO &lt;div style="width:100%;">&lt;a title='OAXZ000620'>OAXZ000620&lt;/a>&amp;nbsp&lt;/div>
            workflowRequestTableFieldtc_sqds03.setMand(true);
            workflowRequestTableFieldtc_sqds03.setView(true);
            workflowRequestTableRecords.getWorkflowRequestTableFields().add(workflowRequestTableFieldtc_sqds03);
            //TODO 料件名称
            //   <edit>true</edit>
            //                     <fieldDBType>varchar2(400)</fieldDBType>
            //                     <fieldFormName>field8154</fieldFormName>
            //                     <fieldHtmlType>1</fieldHtmlType>
            //                     <fieldId>8154</fieldId>
            //                     <fieldName>pm</fieldName>
            //                     <fieldOrder>0</fieldOrder>
            //                     <fieldShowName>品名</fieldShowName>
            //                     <fieldShowValue>不锈钢游标卡尺&amp;lt;1330&amp;gt; 艾瑞泽</fieldShowValue>
            //                     <fieldType>1</fieldType>
            //                     <fieldValue>不锈钢游标卡尺&amp;lt;1330&amp;gt; 艾瑞泽</fieldValue>
            //                     <filedHtmlShow>不锈钢游标卡尺&amp;lt;1330&amp;gt; 艾瑞泽</filedHtmlShow>
            //                     <mand>false</mand>
            //                     <view>true</view>
            WorkflowRequestTableField workflowRequestTableFieldtc_sqds04 = new WorkflowRequestTableField();
            workflowRequestTableFieldtc_sqds04.setEdit(true);
            workflowRequestTableFieldtc_sqds04.setFieldDBType("varchar2(400)");
            workflowRequestTableFieldtc_sqds04.setFieldFormName("field8154");
            workflowRequestTableFieldtc_sqds04.setFieldHtmlType("1");
            workflowRequestTableFieldtc_sqds04.setFieldId("8154");//ljbm
            workflowRequestTableFieldtc_sqds04.setFieldName("pm");
            workflowRequestTableFieldtc_sqds04.setFieldOrder(0);
            workflowRequestTableFieldtc_sqds04.setFieldShowName("品名");
            String TC_SQDS04 = sqdsList.get(i).get("TC_SQDS04")!=null?sqdsList.get(i).get("TC_SQDS04").toString():"无";
            workflowRequestTableFieldtc_sqds04.setFieldShowValue(TC_SQDS04);//<fieldShowValue>不锈钢游标卡尺&amp;lt;1330&amp;gt; 艾瑞泽</fieldShowValue>
            workflowRequestTableFieldtc_sqds04.setFieldType("1");
            workflowRequestTableFieldtc_sqds04.setFieldValue(TC_SQDS04);//<fieldValue>不锈钢游标卡尺&amp;lt;1330&amp;gt; 艾瑞泽</fieldValue>
            workflowRequestTableFieldtc_sqds04.setFiledHtmlShow(TC_SQDS04);// <filedHtmlShow>不锈钢游标卡尺&amp;lt;1330&amp;gt; 艾瑞泽</filedHtmlShow>
            workflowRequestTableFieldtc_sqds04.setMand(false);
            workflowRequestTableFieldtc_sqds04.setView(true);
            workflowRequestTableRecords.getWorkflowRequestTableFields().add(workflowRequestTableFieldtc_sqds04);

            //TODO 规格
            //
            //                     <edit>true</edit>
            //                     <fieldDBType>varchar2(400)</fieldDBType>
            //                     <fieldFormName>field8155</fieldFormName>
            //                     <fieldHtmlType>1</fieldHtmlType>
            //                     <fieldId>8155</fieldId>
            //                     <fieldName>gg</fieldName>
            //                     <fieldOrder>0</fieldOrder>
            //                     <fieldShowName>规格</fieldShowName>
            //                     <fieldShowValue>&amp;lt;1330&amp;gt;</fieldShowValue>
            //                     <fieldType>1</fieldType>
            //                     <fieldValue>&amp;lt;1330&amp;gt;</fieldValue>
            //                     <filedHtmlShow>&amp;lt;1330&amp;gt;</filedHtmlShow>
            //                     <mand>false</mand>
            //                     <view>true</view>
            WorkflowRequestTableField workflowRequestTableFieldtc_sqds05 = new WorkflowRequestTableField();
            workflowRequestTableFieldtc_sqds05.setEdit(true);
            workflowRequestTableFieldtc_sqds05.setFieldDBType("varchar2(400)");
            workflowRequestTableFieldtc_sqds05.setFieldFormName("field8155");
            workflowRequestTableFieldtc_sqds05.setFieldHtmlType("1");
            workflowRequestTableFieldtc_sqds05.setFieldId("8155");
            workflowRequestTableFieldtc_sqds05.setFieldName("gg");
            workflowRequestTableFieldtc_sqds05.setFieldOrder(0);
            workflowRequestTableFieldtc_sqds05.setFieldShowName("规格");
            String TC_SQDS05 =  sqdsList.get(i).get("TC_SQDS05")!=null?sqdsList.get(i).get("TC_SQDS05").toString():"无";
            workflowRequestTableFieldtc_sqds05.setFieldShowValue(TC_SQDS05);
            workflowRequestTableFieldtc_sqds05.setFieldType("1");
            workflowRequestTableFieldtc_sqds05.setFieldValue(TC_SQDS05);
            workflowRequestTableFieldtc_sqds05.setFiledHtmlShow(TC_SQDS05);
            workflowRequestTableFieldtc_sqds05.setMand(false);
            workflowRequestTableFieldtc_sqds05.setView(true);
            workflowRequestTableRecords.getWorkflowRequestTableFields().add(workflowRequestTableFieldtc_sqds05);
            //TODO 单位
            //   <edit>true</edit>
            //                     <fieldDBType>varchar2(400)</fieldDBType>
            //                     <fieldFormName>field8156</fieldFormName>
            //                     <fieldHtmlType>1</fieldHtmlType>
            //                     <fieldId>8156</fieldId>
            //                     <fieldName>dw</fieldName>
            //                     <fieldOrder>0</fieldOrder>
            //                     <fieldShowName>单位</fieldShowName>
            //                     <fieldShowValue>PCS</fieldShowValue>
            //                     <fieldType>1</fieldType>
            //                     <fieldValue>PCS</fieldValue>
            //                     <filedHtmlShow>PCS</filedHtmlShow>
            //                     <mand>false</mand>
            //                     <view>true</view>
            WorkflowRequestTableField workflowRequestTableFieldtc_sqds06 = new WorkflowRequestTableField();
            workflowRequestTableFieldtc_sqds06.setEdit(true);
            workflowRequestTableFieldtc_sqds06.setFieldDBType("varchar2(400)");
            workflowRequestTableFieldtc_sqds06.setFieldShowName("field8156");
            workflowRequestTableFieldtc_sqds06.setFieldHtmlType("1");
            workflowRequestTableFieldtc_sqds06.setFieldId("8156");
            workflowRequestTableFieldtc_sqds06.setFieldName("dw");
            workflowRequestTableFieldtc_sqds06.setFieldOrder(0);
            workflowRequestTableFieldtc_sqds06.setFieldShowName("单位");
            String TC_SQDS06 = sqdsList.get(i).get("TC_SQDS06")!=null?sqdsList.get(i).get("TC_SQDS06").toString():"无";
            workflowRequestTableFieldtc_sqds06.setFieldShowName(TC_SQDS06);
            workflowRequestTableFieldtc_sqds06.setFieldType("1");
            workflowRequestTableFieldtc_sqds06.setFieldValue(TC_SQDS06);
            workflowRequestTableFieldtc_sqds06.setFiledHtmlShow(TC_SQDS06);
            workflowRequestTableFieldtc_sqds06.setMand(false);
            workflowRequestTableFieldtc_sqds06.setView(true);
            workflowRequestTableRecords.getWorkflowRequestTableFields().add(workflowRequestTableFieldtc_sqds06);
            //TODO 单价tc_sqds07
            //  <edit>true</edit>
            //                     <fieldDBType>number(15,3)</fieldDBType>
            //                     <fieldFormName>field8157</fieldFormName>
            //                     <fieldHtmlType>1</fieldHtmlType>
            //                     <fieldId>8157</fieldId>
            //                     <fieldName>dj</fieldName>
            //                     <fieldOrder>0</fieldOrder>
            //                     <fieldShowName>单价</fieldShowName>
            //                     <fieldShowValue>66</fieldShowValue>
            //                     <fieldType>3</fieldType>
            //                     <fieldValue>66</fieldValue>
            //                     <filedHtmlShow>66</filedHtmlShow>
            //                     <mand>false</mand>
            //                     <view>true</view>
            WorkflowRequestTableField workflowRequestTableFieldtc_sqds07 = new WorkflowRequestTableField();
            workflowRequestTableFieldtc_sqds07.setEdit(true);
            workflowRequestTableFieldtc_sqds07.setFieldDBType("number(15,3)");
            workflowRequestTableFieldtc_sqds07.setFieldFormName("field8157");
            workflowRequestTableFieldtc_sqds07.setFieldHtmlType("1");
            workflowRequestTableFieldtc_sqds07.setFieldId("8157");
            workflowRequestTableFieldtc_sqds07.setFieldName("dj");
            workflowRequestTableFieldtc_sqds07.setFieldOrder(0);
            workflowRequestTableFieldtc_sqds07.setFieldShowName("单价");
            String TC_SQDS07 = sqdsList.get(i).get("TC_SQDS07")!=null?sqdsList.get(i).get("TC_SQDS07").toString():"0.00";
            workflowRequestTableFieldtc_sqds07.setFieldShowValue(TC_SQDS07);
            workflowRequestTableFieldtc_sqds07.setFieldType("3");
            workflowRequestTableFieldtc_sqds07.setFieldValue(TC_SQDS07);
            workflowRequestTableFieldtc_sqds07.setFiledHtmlShow(TC_SQDS07);
            workflowRequestTableFieldtc_sqds07.setMand(false);
            workflowRequestTableFieldtc_sqds07.setView(true);
            workflowRequestTableRecords.getWorkflowRequestTableFields().add(workflowRequestTableFieldtc_sqds07);
            //TODO 数量tc_sqds11
            // <edit>true</edit>
            //                     <fieldDBType>number(15,3)</fieldDBType>
            //                     <fieldFormName>field8158</fieldFormName>
            //                     <fieldHtmlType>1</fieldHtmlType>
            //                     <fieldId>8158</fieldId>
            //                     <fieldName>sl</fieldName>
            //                     <fieldOrder>0</fieldOrder>
            //                     <fieldShowName>数量</fieldShowName>
            //                     <fieldShowValue>1212</fieldShowValue>
            //                     <fieldType>3</fieldType>
            //                     <fieldValue>1212</fieldValue>
            //                     <filedHtmlShow>1212</filedHtmlShow>
            //                     <mand>true</mand>
            //                     <view>true</view>
            WorkflowRequestTableField workflowRequestTableFieldtc_sqds11 = new WorkflowRequestTableField();
            workflowRequestTableFieldtc_sqds11.setEdit(true);
            workflowRequestTableFieldtc_sqds11.setFieldDBType("number(15,3)");
            workflowRequestTableFieldtc_sqds11.setFieldFormName("field8158");
            workflowRequestTableFieldtc_sqds11.setFieldHtmlType("1");
            workflowRequestTableFieldtc_sqds11.setFieldId("8158");
            workflowRequestTableFieldtc_sqds11.setFieldName("sl");
            workflowRequestTableFieldtc_sqds11.setFieldOrder(0);
            workflowRequestTableFieldtc_sqds11.setFieldShowName("数量");
            String TC_SQDS11 = sqdsList.get(i).get("TC_SQDS11")!=null ?sqdsList.get(i).get("TC_SQDS11").toString():"0.00";
            workflowRequestTableFieldtc_sqds11.setFieldShowValue(TC_SQDS11);
            workflowRequestTableFieldtc_sqds11.setFieldType("3");
            workflowRequestTableFieldtc_sqds11.setFieldValue(TC_SQDS11);
            workflowRequestTableFieldtc_sqds11.setFiledHtmlShow(TC_SQDS11);
            workflowRequestTableFieldtc_sqds11.setMand(false);
            workflowRequestTableFieldtc_sqds11.setView(true);
            workflowRequestTableRecords.getWorkflowRequestTableFields().add(workflowRequestTableFieldtc_sqds11);
            //TODO 总价tc_sqds12
            //  <edit>true</edit>
            //                     <fieldDBType>number(15,2)</fieldDBType>
            //                     <fieldFormName>field8159</fieldFormName>
            //                     <fieldHtmlType>1</fieldHtmlType>
            //                     <fieldId>8159</fieldId>
            //                     <fieldName>zj</fieldName>
            //                     <fieldOrder>0</fieldOrder>
            //                     <fieldShowName>总价</fieldShowName>
            //                     <fieldShowValue>79992</fieldShowValue>
            //                     <fieldType>3</fieldType>
            //                     <fieldValue>79992</fieldValue>
            //                     <filedHtmlShow>79992</filedHtmlShow>
            //                     <mand>false</mand>
            //                     <view>true</view>

            WorkflowRequestTableField workflowRequestTableFieldtc_sqds12 = new WorkflowRequestTableField();
            workflowRequestTableFieldtc_sqds12.setEdit(true);
            workflowRequestTableFieldtc_sqds12.setFieldDBType("number(15,3)");
            workflowRequestTableFieldtc_sqds12.setFieldFormName("field8159");
            workflowRequestTableFieldtc_sqds12.setFieldHtmlType("1");
            workflowRequestTableFieldtc_sqds12.setFieldId("8159");
            workflowRequestTableFieldtc_sqds12.setFieldName("zj");
            workflowRequestTableFieldtc_sqds12.setFieldOrder(0);
            workflowRequestTableFieldtc_sqds12.setFieldShowName("总价");
            String TC_SQDS12 = sqdsList.get(i).get("TC_SQDS12")!=null ? sqdsList.get(i).get("TC_SQDS12").toString() :"0.00";
            workflowRequestTableFieldtc_sqds12.setFieldShowValue(TC_SQDS12);
            workflowRequestTableFieldtc_sqds12.setFieldType("3");
            workflowRequestTableFieldtc_sqds12.setFieldValue(TC_SQDS12);
            workflowRequestTableFieldtc_sqds12.setFiledHtmlShow(TC_SQDS12);
            workflowRequestTableFieldtc_sqds12.setMand(false);
            workflowRequestTableFieldtc_sqds12.setView(true);
            workflowRequestTableRecords.getWorkflowRequestTableFields().add(workflowRequestTableFieldtc_sqds12);
            // TODO 本月已采购数量 tc_sqds13
            // <edit>true</edit>
            //                     <fieldDBType>number(15,3)</fieldDBType>
            //                     <fieldFormName>field8160</fieldFormName>
            //                     <fieldHtmlType>1</fieldHtmlType>
            //                     <fieldId>8160</fieldId>
            //                     <fieldName>bycgsl</fieldName>
            //                     <fieldOrder>0</fieldOrder>
            //                     <fieldShowName>本月已采购数量</fieldShowName>
            //                     <fieldShowValue>0</fieldShowValue>
            //                     <fieldType>3</fieldType>
            //                     <fieldValue>0</fieldValue>
            //                     <filedHtmlShow>0</filedHtmlShow>
            //                     <mand>false</mand>
            //                     <view>true</view>

            WorkflowRequestTableField workflowRequestTableFieldtc_sqds13 = new WorkflowRequestTableField();
            workflowRequestTableFieldtc_sqds13.setEdit(true);
            workflowRequestTableFieldtc_sqds13.setFieldDBType("number(15,3)");
            workflowRequestTableFieldtc_sqds13.setFieldFormName("field8160");
            workflowRequestTableFieldtc_sqds13.setFieldHtmlType("1");
            workflowRequestTableFieldtc_sqds13.setFieldId("8160");
            workflowRequestTableFieldtc_sqds13.setFieldName("bycgsl");
            workflowRequestTableFieldtc_sqds13.setFieldOrder(0);
            workflowRequestTableFieldtc_sqds13.setFieldShowName("本月已采购数量");
            String TC_SQDS13 = sqdsList.get(i).get("TC_SQDS13")!=null?sqdsList.get(i).get("TC_SQDS13").toString():"0.00";
            workflowRequestTableFieldtc_sqds13.setFieldShowValue(TC_SQDS13);
            workflowRequestTableFieldtc_sqds13.setFieldType("3");
            workflowRequestTableFieldtc_sqds13.setFieldValue(TC_SQDS13);
            workflowRequestTableFieldtc_sqds13.setFiledHtmlShow(TC_SQDS13);
            workflowRequestTableFieldtc_sqds13.setMand(false);
            workflowRequestTableFieldtc_sqds13.setView(true);
            workflowRequestTableRecords.getWorkflowRequestTableFields().add(workflowRequestTableFieldtc_sqds13);
            //    定额数量
            //                     <edit>true</edit>
            //                     <fieldDBType>number(15,3)</fieldDBType>
            //                     <fieldFormName>field8161</fieldFormName>
            //                     <fieldHtmlType>1</fieldHtmlType>
            //                     <fieldId>8161</fieldId>
            //                     <fieldName>desl</fieldName>
            //                     <fieldOrder>0</fieldOrder>
            //                     <fieldShowName>定额数量</fieldShowName>
            //                     <fieldShowValue>0</fieldShowValue>
            //                     <fieldType>3</fieldType>
            //                     <fieldValue>0</fieldValue>
            //                     <filedHtmlShow>0</filedHtmlShow>
            //                     <mand>false</mand>
            //                     <view>true</view>
            WorkflowRequestTableField workflowRequestTableFielddinge = new WorkflowRequestTableField();
            workflowRequestTableFielddinge.setEdit(true);
            workflowRequestTableFielddinge.setFieldDBType("number(15,3)");
            workflowRequestTableFielddinge.setFieldFormName("field8161");
            workflowRequestTableFielddinge.setFieldHtmlType("1");
            workflowRequestTableFielddinge.setFieldId("8161");
            workflowRequestTableFielddinge.setFieldName("desl");
            workflowRequestTableFielddinge.setFieldOrder(0);
            workflowRequestTableFielddinge.setFieldShowName("定额数量");
            workflowRequestTableFielddinge.setFieldShowValue("0");
            workflowRequestTableFielddinge.setFieldType("3");
            workflowRequestTableFielddinge.setFieldValue("0");
            workflowRequestTableFielddinge.setFiledHtmlShow("0");
            workflowRequestTableFielddinge.setMand(false);
            workflowRequestTableFielddinge.setView(true);
            workflowRequestTableRecords.getWorkflowRequestTableFields().add(workflowRequestTableFielddinge);

            //TODO
            //                     <edit>true</edit>
            //                     <fieldDBType>number(15,3)</fieldDBType>
            //                     <fieldFormName>field8162</fieldFormName>
            //                     <fieldHtmlType>1</fieldHtmlType>
            //                     <fieldId>8162</fieldId>
            //                     <fieldName>cdesl</fieldName>
            //                     <fieldOrder>0</fieldOrder>
            //                     <fieldShowName>超定额数量</fieldShowName>
            //                     <fieldShowValue>1212</fieldShowValue>
            //                     <fieldType>3</fieldType>
            //                     <fieldValue>1212</fieldValue>
            //                     <filedHtmlShow>1212</filedHtmlShow>
            //                     <mand>false</mand>
            //                     <view>true</view>
            WorkflowRequestTableField workflowRequestTableFielcde = new WorkflowRequestTableField();
            workflowRequestTableFielcde.setEdit(true);
            workflowRequestTableFielcde.setFieldDBType("number(15,3)");
            workflowRequestTableFielcde.setFieldFormName("field8162");
            workflowRequestTableFielcde.setFieldHtmlType("1");
            workflowRequestTableFielcde.setFieldId("8162");
            workflowRequestTableFielcde.setFieldName("cdesl");
            workflowRequestTableFielcde.setFieldOrder(0);
            workflowRequestTableFielcde.setFieldShowName("超定额数量");
            workflowRequestTableFielcde.setFieldShowValue("0");
            workflowRequestTableFielcde.setFieldType("3");
            workflowRequestTableFielcde.setFieldValue("0");
            workflowRequestTableFielcde.setFiledHtmlShow("0");
            workflowRequestTableFielcde.setMand(false);
            workflowRequestTableFielcde.setView(true);
            workflowRequestTableRecords.getWorkflowRequestTableFields().add(workflowRequestTableFielcde);

            //  TODO <edit>true</edit>
            //                     <fieldDBType>number(15,2)</fieldDBType>
            //                     <fieldFormName>field8163</fieldFormName>
            //                     <fieldHtmlType>1</fieldHtmlType>
            //                     <fieldId>8163</fieldId>
            //                     <fieldName>cdeje</fieldName>
            //                     <fieldOrder>0</fieldOrder>
            //                     <fieldShowName>超定额金额</fieldShowName>
            //                     <fieldShowValue>0</fieldShowValue>
            //                     <fieldType>3</fieldType>
            //                     <fieldValue>0</fieldValue>
            //                     <filedHtmlShow>0</filedHtmlShow>
            //                     <mand>false</mand>
            //                     <view>true</view>

            WorkflowRequestTableField workflowRequestTableFielcdeje = new WorkflowRequestTableField();
            workflowRequestTableFielcdeje.setEdit(true);
            workflowRequestTableFielcdeje.setFieldDBType("number(15,2)");
            workflowRequestTableFielcdeje.setFieldFormName("field8163");
            workflowRequestTableFielcdeje.setFieldHtmlType("1");
            workflowRequestTableFielcdeje.setFieldId("8163");
            workflowRequestTableFielcdeje.setFieldName("cdeje");
            workflowRequestTableFielcdeje.setFieldOrder(0);
            workflowRequestTableFielcdeje.setFieldShowName("超定额金额");
            workflowRequestTableFielcdeje.setFieldShowValue("0");
            workflowRequestTableFielcdeje.setFieldType("3");
            workflowRequestTableFielcdeje.setFieldValue("0");
            workflowRequestTableFielcdeje.setFiledHtmlShow("0");
            workflowRequestTableFielcdeje.setMand(false);
            workflowRequestTableFielcdeje.setView(true);
            workflowRequestTableRecords.getWorkflowRequestTableFields().add(workflowRequestTableFielcdeje);

            //  TODO 备注
            //                     <edit>true</edit>
            //                     <fieldDBType>varchar2(400)</fieldDBType>
            //                     <fieldFormName>field8165</fieldFormName>
            //                     <fieldHtmlType>1</fieldHtmlType>
            //                     <fieldId>8165</fieldId>
            //                     <fieldName>bz</fieldName>
            //                     <fieldOrder>0</fieldOrder>
            //                     <fieldShowName>备注</fieldShowName>
            //                     <fieldShowValue>12</fieldShowValue>
            //                     <fieldType>1</fieldType>
            //                     <fieldValue>12</fieldValue>
            //                     <filedHtmlShow>12</filedHtmlShow>
            //                     <mand>false</mand>
            //                     <view>true</view>

            WorkflowRequestTableField workflowRequestTableFieltc_sqds15 = new WorkflowRequestTableField();
            workflowRequestTableFieltc_sqds15.setEdit(true);
            workflowRequestTableFieltc_sqds15.setFieldDBType("varchar2(400)");
            workflowRequestTableFieltc_sqds15.setFieldFormName("field8165");
            workflowRequestTableFieltc_sqds15.setFieldHtmlType("1");
            workflowRequestTableFieltc_sqds15.setFieldId("8165");
            workflowRequestTableFieltc_sqds15.setFieldName("bz");
            workflowRequestTableFieltc_sqds15.setFieldOrder(0);
            workflowRequestTableFieltc_sqds15.setFieldShowName("备注");
            String TC_SQDS15 = sqdsList.get(i).get("TC_SQDS15")!=null ?sqdsList.get(i).get("TC_SQDS15").toString():"无";
            workflowRequestTableFieltc_sqds15.setFieldShowValue(TC_SQDS15);
            workflowRequestTableFieltc_sqds15.setFieldType("3");
            workflowRequestTableFieltc_sqds15.setFieldValue(TC_SQDS15);
            workflowRequestTableFieltc_sqds15.setFiledHtmlShow(TC_SQDS15);
            workflowRequestTableFieltc_sqds15.setMand(false);
            workflowRequestTableFieltc_sqds15.setView(true);
            workflowRequestTableRecords.getWorkflowRequestTableFields().add(workflowRequestTableFieltc_sqds15);

            //    TODO ERP料号tc_sqds09
            //                     <edit>true</edit>
            //                     <fieldDBType>varchar2(400)</fieldDBType>
            //                     <fieldFormName>field8164</fieldFormName>
            //                     <fieldHtmlType>1</fieldHtmlType>
            //                     <fieldId>8164</fieldId>
            //                     <fieldName>ERPlh</fieldName>
            //                     <fieldOrder>0</fieldOrder>
            //                     <fieldShowName>ERP料号</fieldShowName>
            //                     <fieldShowValue>MISC</fieldShowValue>
            //                     <fieldType>1</fieldType>
            //                     <fieldValue>MISC</fieldValue>
            //                     <filedHtmlShow>MISC</filedHtmlShow>
            //                     <mand>false</mand>
            //                     <view>true</view>

            WorkflowRequestTableField workflowRequestTableFieltc_sqds09 = new WorkflowRequestTableField();
            workflowRequestTableFieltc_sqds09.setEdit(true);
            workflowRequestTableFieltc_sqds09.setFieldDBType("varchar2(400)");
            workflowRequestTableFieltc_sqds09.setFieldFormName("field8164");
            workflowRequestTableFieltc_sqds09.setFieldHtmlType("1");
            workflowRequestTableFieltc_sqds09.setFieldId("8164");
            workflowRequestTableFieltc_sqds09.setFieldName("ERPlh");
            workflowRequestTableFieltc_sqds09.setFieldOrder(0);
            workflowRequestTableFieltc_sqds09.setFieldShowName("ERP料号");
            String TC_SQDS09 = sqdsList.get(i).get("TC_SQDS09")!=null?sqdsList.get(i).get("TC_SQDS09").toString():"无";
            workflowRequestTableFieltc_sqds09.setFieldShowValue(TC_SQDS09);
            workflowRequestTableFieltc_sqds09.setFieldType("3");
            workflowRequestTableFieltc_sqds09.setFieldValue(TC_SQDS09);
            workflowRequestTableFieltc_sqds09.setFiledHtmlShow(TC_SQDS09);
            workflowRequestTableFieltc_sqds09.setMand(false);
            workflowRequestTableFieltc_sqds09.setView(true);
            workflowRequestTableRecords.getWorkflowRequestTableFields().add(workflowRequestTableFieltc_sqds09);

            //    TODO ERP部门编码tc_sqds10
            //                     <edit>true</edit>
            //                     <fieldDBType>browser.bmmc</fieldDBType>
            //                     <fieldFormName>field8521</fieldFormName>
            //                     <fieldHtmlType>3</fieldHtmlType>
            //                     <fieldId>8521</fieldId>
            //                     <fieldName>erpbmbm</fieldName>
            //                     <fieldOrder>0</fieldOrder>
            //                     <fieldShowName>ERP部门编码</fieldShowName>
            //                     <fieldShowValue>&lt;a title=''>&lt;/a>&amp;nbsp</fieldShowValue>
            //                     <fieldType>161</fieldType>
            //                     <fieldValue>ZPS07</fieldValue>
            //                     <filedHtmlShow>&lt;div style="width:100%;">&lt;a title=''>&lt;/a>&amp;nbsp&lt;/div></filedHtmlShow>
            //                     <mand>false</mand>
            //                     <view>true</view>

          /* WorkflowRequestTableField workflowRequestTableFieltc_sqds10 = new WorkflowRequestTableField();
           workflowRequestTableFieltc_sqds10.setEdit(true);
           workflowRequestTableFieltc_sqds10.setFieldDBType("browser.bmmc");
           workflowRequestTableFieltc_sqds10.setFieldFormName("field8521");
           workflowRequestTableFieltc_sqds10.setFieldHtmlType("1");
           workflowRequestTableFieltc_sqds10.setFieldId("8521");
           workflowRequestTableFieltc_sqds10.setFieldName("erpbmbm");
           workflowRequestTableFieltc_sqds10.setFieldOrder(0);
           workflowRequestTableFieltc_sqds10.setFieldShowName("ERP部门编码");
           String TC_SQDS10 = sqdsList.get(i).get("TC_SQDS10")!=null ?sqdsList.get(i).get("TC_SQDS10").toString():"无";
           workflowRequestTableFieltc_sqds10.setFieldShowValue(TC_SQDS10);
           workflowRequestTableFieltc_sqds10.setFieldType("3");
           workflowRequestTableFieltc_sqds10.setFieldValue(TC_SQDS10);
           workflowRequestTableFieltc_sqds10.setFiledHtmlShow(TC_SQDS10);
           workflowRequestTableFieltc_sqds10.setMand(false);
           workflowRequestTableFieltc_sqds10.setView(true);
           workflowRequestTableRecords.getWorkflowRequestTableFields().add(workflowRequestTableFieltc_sqds10);*/


            //  TODO  起订数量 tc_sqds08
            //                <edit>true</edit>
            //                     <fieldDBType>number(15,2)</fieldDBType>
            //                     <fieldFormName>field12160</fieldFormName>
            //                     <fieldHtmlType>1</fieldHtmlType>
            //                     <fieldId>12160</fieldId>
            //                     <fieldName>sl1</fieldName>
            //                     <fieldOrder>0</fieldOrder>
            //                     <fieldShowName>起订数量</fieldShowName>
            //                     <fieldType>3</fieldType>
            //                     <mand>false</mand>
            //                     <view>true</view>

            WorkflowRequestTableField workflowRequestTableFieltc_sqds08 = new WorkflowRequestTableField();
            workflowRequestTableFieltc_sqds08.setEdit(true);
            workflowRequestTableFieltc_sqds08.setFieldDBType("number(15,2)");
            workflowRequestTableFieltc_sqds08.setFieldFormName("field12160");
            workflowRequestTableFieltc_sqds08.setFieldHtmlType("1");
            workflowRequestTableFieltc_sqds08.setFieldId("12160");
            workflowRequestTableFieltc_sqds08.setFieldName("sl1");
            workflowRequestTableFieltc_sqds08.setFieldOrder(0);
            workflowRequestTableFieltc_sqds08.setFieldShowName("起订数量");
            String TC_SQDS08 = sqdsList.get(i).get("TC_SQDS08")!=null?sqdsList.get(i).get("TC_SQDS08").toString():"0.00";
            workflowRequestTableFieltc_sqds08.setFieldShowValue(TC_SQDS08);
            workflowRequestTableFieltc_sqds08.setFieldType("3");
            workflowRequestTableFieltc_sqds08.setFieldValue(TC_SQDS08);
            workflowRequestTableFieltc_sqds08.setFiledHtmlShow(TC_SQDS08);
            workflowRequestTableFieltc_sqds08.setMand(false);
            workflowRequestTableFieltc_sqds08.setView(true);
            workflowRequestTableRecords.getWorkflowRequestTableFields().add(workflowRequestTableFieltc_sqds08);

            //   TODO 相减数
            //                     <edit>true</edit>
            //                     <fieldDBType>number(15,2)</fieldDBType>
            //                     <fieldFormName>field12161</fieldFormName>
            //                     <fieldHtmlType>1</fieldHtmlType>
            //                     <fieldId>12161</fieldId>
            //                     <fieldName>xjs</fieldName>
            //                     <fieldOrder>0</fieldOrder>
            //                     <fieldShowName>相减数</fieldShowName>
            //                     <fieldShowValue>1212</fieldShowValue>
            //                     <fieldType>3</fieldType>
            //                     <fieldValue>1212</fieldValue>
            //                     <filedHtmlShow>1212</filedHtmlShow>
            //                     <mand>false</mand>
            //                     <view>true</view>

            WorkflowRequestTableField workflowRequestTableFieltc_sqdsxjs = new WorkflowRequestTableField();
            workflowRequestTableFieltc_sqdsxjs.setEdit(true);
            workflowRequestTableFieltc_sqdsxjs.setFieldDBType("number(15,2)");
            workflowRequestTableFieltc_sqdsxjs.setFieldFormName("field12161");
            workflowRequestTableFieltc_sqdsxjs.setFieldHtmlType("1");
            workflowRequestTableFieltc_sqdsxjs.setFieldId("12161");
            workflowRequestTableFieltc_sqdsxjs.setFieldName("xjs");
            workflowRequestTableFieltc_sqdsxjs.setFieldOrder(0);
            workflowRequestTableFieltc_sqdsxjs.setFieldShowName("相减数");
            workflowRequestTableFieltc_sqdsxjs.setFieldShowValue("0");
            workflowRequestTableFieltc_sqdsxjs.setFieldType("3");
            workflowRequestTableFieltc_sqdsxjs.setFieldValue("0");
            workflowRequestTableFieltc_sqdsxjs.setFiledHtmlShow("0");
            workflowRequestTableFieltc_sqdsxjs.setMand(false);
            workflowRequestTableFieltc_sqdsxjs.setView(true);
            workflowRequestTableRecords.getWorkflowRequestTableFields().add(workflowRequestTableFieltc_sqdsxjs);

            workflowDetailTableInfos.getWorkflowRequestTableRecords().add(workflowRequestTableRecords);

        }

        workflowRequestInfo.setWorkflowMainTableInfo(workflowMainTableInfo);

        workflowRequestInfo.getWorkflowDetailTableInfos().add(workflowDetailTableInfos);

        workflowRequestInfo.setWorkflowBaseInfo(workflowBaseInfo);
        logger.debug(JSON.toJSONString(workflowRequestInfo));
        logger.debug("发起流程getUserId="+info.getUserId());
        String doCreateWorkflowRequest;
        try {
            doCreateWorkflowRequest = erpwsImplService.getERPWSImplPort().doCreateWorkflowRequest(workflowRequestInfo, Integer.valueOf(info.getUserId()));

        } catch (Exception e) {
            e.printStackTrace();
            return "-9";
        }

        logger.debug("发起流程doCreateWorkflowRequest=" + doCreateWorkflowRequest + erpwsImplService.toString());
        String tc_sqds18 = null;
        String tc_sqds16 = null;

        if (!NumberUtils.isDigits(doCreateWorkflowRequest)) {
            // doCreateWorkflowRequest = "1";//流程状态1流程准备中，2创建成功，3，创建失败，4撤单中，5撤单成功
            tc_sqds18 = "未知的错误";
            tc_sqds16 = "1";
            doCreateWorkflowRequest = "-9";
        } else {
            switch (doCreateWorkflowRequest) {
                case "-1":
                    tc_sqds18 = "流程创建失败";
                    tc_sqds16 = "3";
                    break;
                case "-2":
                    tc_sqds18 = "没有创建权限";
                    tc_sqds16 = "3";
                    break;
                case "-3":
                    tc_sqds18 = "创建流程失败";
                    tc_sqds16 = "3";
                    break;
                case "-4":
                    tc_sqds18 = "字段或者表名不正确";
                    tc_sqds16 = "3";
                    break;
                case "-5":
                    tc_sqds18 = "更新流程级别失败";
                    tc_sqds16 = "3";
                    break;
                case "-6":
                    tc_sqds18 = "无法创建流程代办任务";
                    tc_sqds16 = "3";
                    break;
                case "-7":
                    tc_sqds18 = "流程下一节点出错，检查流程配置";
                    tc_sqds16 = "3";
                    break;
                case "-8":
                    tc_sqds18 = "流程下一节点出错，检查流程配置";
                    tc_sqds16 = "3";
                    break;
                default:
                    tc_sqds16 = "2";
                    tc_sqds18 = "流程创建成功";
                    break;
            }
        }
        if ("DS1".equals(ds)) {
            this.imaFileMapper.insertByOA(sqId, ds, workshop, purchase, doCreateWorkflowRequest, tc_sqds18, tc_sqds16);
        }

        return doCreateWorkflowRequest;
    }

    public boolean sendMailutil(String senderto, String subject, String body){
        MailBean mailBean = MailBean.getMailBean();
        /**
         * HTML邮件正文发送测试
         */
        mailBean.setSubject(subject);
        String html =
                "<html>"
                        + "<body>"
                        + "<p><h1>"+body+"</h1></p>"
                        + "<p  align='right'><h5>此邮件为系统自动发送，请勿回复！！！</h5></p>"
                        + "</body>"
                        + "</html>";

        mailBean.setText(html);
        //  mailBean.setAttachmentFilename("辅料.xlsx");
        // mailBean.setFile(new FileSystemResource("D:/upload/2020-09-04_辅料EXCEL.xlsx"));
        try {
            mailUtil.sendMailHtml(mailBean,senderto);

        }catch (Exception e){
            e.printStackTrace();
            return false;
        }

        return true;
    }


    public boolean sendMailAttachment(String senderto, String subject, String body, String fileName) {
        try {
            Thread.sleep(1);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        MailBean mailBean = MailBean.getMailBean();
        /**
         * HTML邮件正文发送测试
         */
        mailBean.setSubject(subject);
        String html =
                "<html>"
                        + "<body>"
                        + "<p><h1>" + body + "</h1></p>"
                        + "<p  align='right'><h5>此邮件为系统自动发送，请勿回复！！！</h5></p>"
                        + "</body>"
                        + "</html>";

        mailBean.setText(html);
        mailBean.setAttachmentFilename(fileName);
        mailBean.setFile(new FileSystemResource("/home/javawork/oaerp/file/download/" + fileName));
        try {
            mailUtil.sendMailAttachment(mailBean, senderto);
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }


        return true;
    }


}
